Tinkerwell 4 is out now! See what's new or buy now.
Tinkerwell background image
Tinkerwell Logo Tinkerwell
The guide for Symfony developers is coming soon! In the meantime, you can check out the Laravel guide to become inspired and adapt it to Symfony.

Tinkerwell for Laravel
#

Tinkerwell was initially built for Laravel developers and is php artisan tinker on steroids. While the app got support for many other frameworks over the years, the main focus is still the Laravel framework and this is why it ships with a default project that allows you to use Laravel helpers and tools like the Http client directly without connecting to a custom project.

So if you are a Laravel developer like us – Tinkerwell is for you.

Remote connections
#

The most powerful feature of Tinkerwell is the remote connection that connects to your applications in production and can run code without changing a file. You can dig into the data of your apps without downloading personal information to your local machine or run snippets without creating and deploying commands.

Examples
#

We’ve put together examples of Tinkerwell use cases and scenarios that we solve with Tinkerwell on a daily basis and where is no other solution that allows us to do it that seamlessly. Tinkerwell replaces the creation of dummy routes in your routes file and switching between your IDE and the browser all the time to run your code.

Eloquent queries
#

Tinkerwell is the perfect tool to query your database – locally or remote – to get more insights into your application. Instead of writing complex SQL queries, simply use Eloquent.

The following Eloquent query returns all users from Beyond Code but also gives you a convenient object with it’s relations – something that’s difficult to achieve in plain SQL.

User::query()
->with('addresses', 'orders', 'licenses')
->where('email', 'LIKE', '%@beyondco.de')
->get()

Data Export

If you want to export the results as a CSV file, you can use the mapping of collections, display it in a table view and export the data direct from Tinkerwell.

User::query()
->with('paddlePurchases')
->where('email', 'LIKE', '[email protected]')
->get()
->map(function ($user) {
return $user->paddlePurchases->shuffle()->map(function ($order) use ($user) {
return [
'created_at' => $order->created_at->format('Y-m-d'),
'user' => $user->name,
'product' => $order->product_name,
];
});
})->flatten(1);

One-time commands
#

Sometimes you want to update many but not all users on certain criterias – but you aren’t comfortable doing this with pure SQL and it’s too complex to fiddle around with the one-line limit of php artisan tinker.

Tinkerwell allows you to do this task without writing and deploying a command to your production environment that you’ll only use once.

User::query()
->where('email', 'LIKE', '%beyondco.de')
->whereHas('paddlePurchases')
->get()
->each(function ($user) {
$user->update([
'is_paying_customer' => true,
]);
});

API Exploration
#

You often find yourself in situations where you want to test API calls without the overhead of your application. Some people are comfortable using curl, but if you want the convenience of code, simply go with the Http facade of Laravel within the default project.

The Http facade allows you to GET and POST data to API endpoints but also include custom data like headers or parameters.

Http::withHeaders([
'X-Demo' => 'This is some header information',
])
->post('https://httpdump.app/dumps/bcec9ebd-f137-48a8-a203-e2692d5b8cad', [
'name' => 'Tinkerwell',
'type' => 'Code Editor',
'rating' => '6 stars only',
]);

Collections
#

If you work with the Laravel framework, you are familiar with collections. You can use them to avoid foreach loops, filter and transform data and much more. In this example, we use Tinkerwell to load all open source repositories of Beyond Code from GitHub and filter for Laravel related packages. After that, we map this to the repository name and flatten the array within a few lines of code.

Aside from this, we use Magic Comments to count the number of open source packages of Beyond Code directly within the editor.

collect(Http::get('https://api.github.com/orgs/beyondcode/repos')->json())
->filter(function ($repo) {
return str($repo['name'])->contains('laravel');
})
->map(function ($repo) {
return $repo['full_name'];
})
->flatten()
/*?->count()*/;

Helpers
#

While it’s common to use Laravel helpers within your projects, do you use them for everyday tasks without a project context? Probably not – but with Tinkerwell this becomes a no-brainer.

str()

Need to convert a headline into a slug? Want to limit a text to a certain number of characters but don’t want to count them yourself? Manually need to create a UUID? We got you covered.

// Creating a slug
str('Tinkerwell for Laravel Developers')->slug(); //?
 
// Generating a UUID
str()->uuid(); //?
 
// Shorten a text
$text = "Tinkerwell is a REPL on steroids. It allows you to run code snippets
within the context of your application without hitting the browser.
It's the perfect companion to your favorite IDE and works locally,
via SSH, Docker and even on Laravel Vapor.";
str($text)->limit(34); //?

These scenarios are just the tip of the iceberg. You can use Tinkerwell for them but find yourself other situations where you reach for the app – and there’s also a PHPStorm plugin for those who don’t even want to leave their favorite IDE.

Tinkerwell: The PHP Scratchpad

The must-have companion to your favorite IDE. Quickly iterate on PHP code within the context of your web application.

Buy now Learn more