Open‑sourcing Tinker.app

Back in 2017 I started working on Tinker.app: a hosted, in-browser version of Laravel's Tinker tool.

For the uninitiated: Tinker is a PHP REPL for Laravel. It allows you to run and debug code without leaving the terminal. Tinker.app would allow you to do all that, but straight from a browser window. As an added bonus, package creators would be able to sandbox and demo their Laravel packages using embedded Tinker.app sessions.

Tinker.app

Together with some help from my colleagues at Spatie we built a very nice proof of concept in a couple of months. Every Tinker session gets its own isolated docker container to play in. Using linux sockets and websockets we pipe the containerised Tinker shell from Dockers, through PHP, through NGINX and into xterm.js on the client side. This means it't not only pretty fast, but it's also a fully featured terminal with all expected bells and whistles. For example, a rogue while(true) loop can be stopped by sending an interrupt signal using ctrl-C!
There's also a minimal but very slick UI that consists of two panes to work with the environment. One for the real time shell mentioned earlier and the other for preparing multiple lines of code to run in one execution (think of it as a scratchpad).
Finally, you can also share you tinker session to collaborate with anyone in the same environment, in real time 🤯.

However, as is often the case with side-projects, this project got sidelined. About a year later Marcel Pociot released Tinkerwell and our need for Tinker.app disappeared. Tinkerwell is everything we could've wished for in Tinker.app and more. It also includes a free, completely in-browser, Laravel environment to play with: https://web.tinkerwell.app/.
So now, another year later we've decided to open-source the code for Tinker.app as-is, in the hope that some of you find it useful or interesting.

The Tinker.app repo is a very rough and unmaintained Laravel 5.7 app. It requires Docker to be installed locally and uses the spatie/tinker.app-image as the Tinker environment that will be hosted.

The curious among us might've also noticed that https://tinker.app/ is actually live and serving Tinker sessions. We'll see how long it lasts until someone inevitably takes it down or adds it to their personal botnet 🤷.

Tinker.app