Tinkerwell background image
Tinkerwell Logo Tinkerwell
Go back to Blog

Multiline REPL for PHP

It doesn’t matter if you are using php artisan tinker in Laravel, n98-magerun in Magento or psysh in a Symfony or custom build PHP project – all these Read-Eval-Print-Loops have in common that you have to write and execute your code line by line.

Running code line by line does work because that’s also how the PHP interpreter evaluates it – but this is not how we as developers think about our code. We see patterns and structures in our code and to build a mental model of the code, we need to see multiple lines at the same time.

Tinkerwell solves this issue – it’s a code runner for PHP that has a normal code editor with autocompletion but also allows your to write and evaluate your code within the context of your application. It is a multi-line REPL on steroids and it makes prototyping and debugging much easier than the psysh based implementations that you run on your terminal.

Using control structures

Console-based REPL interfaces don’t support controls structures like if-then-else statements or loops. They accept only the code that you need at this specific time and running a loop on a bigger dataset and working with these variables doesn’t work within the REPL itself or needs permanent code changes within your application.

Tinkerwell supports these multi-line control structures and simply runs code as if you would create a new function in your application – but without actually changing your application code, commiting it to git and deploying it on an environment.

Run code without installing a REPL

Another benefit of Tinkerwell is that it’s framework independent and doesn’t need a REPL code package within your application at all. Simply connect to your application and it automatically bootstraps the framework and runs the code within your editor.

Local, remote, Docker and Laravel Vapor

Tinkerwell can connect to local applications running directly on your machine as well as to remote environments via SSH, Docker or serverless with Laravel Vapor. This makes running multiple lines of code convenient and you can use one tool to have all your apps in one place.

Tinkerwell: The code runner for PHP

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

Learn more