Laravel Tinker Server is a package by Marcel Pociot that enables you to tinker with your variables in real-time while working on your Laravel app. This package collects data via calls to a
tinker() helper that ships with the package and allow you to then interact with those variables on the fly.
Related: Laravel Dump Server
The best way to demonstrate this package is the following gif from the project’s README file:
The primary usage for this is first starting up a tinker server in a new console session:
1php artisan tinker-server
Then when you call
tinker() from within your code it will be instantly available in an interactive REPL shell. Here’s a basic example from the README:
1$user = App\User::find(1);23tinker($user);
An alternative approach that I use which has similar benefits is setting breakpoints during an XDebug session. If you’re using a client like PhpStorm’s client/UI, you can interactively inspect variables within the scope of the call stack and run code via a console.
The nice thing about using XDebug is that it works for all PHP projects, where this approach is specific to Laravel. You can see this technique in our Learn how to set up Xdebug for PhpStorm and Laravel Valet video.