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:
php 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:
$user = App\User::find(1); tinker($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.
Filed in: Laravel Packages
Join the weekly newsletter and never miss out on new tips, tutorials, and more.
- Full Stack or Back-End Developer
Alexandria, VA; Tallahassee, FL; Orlando, FL
Marketing for Change
- Senior Quality Assurance Engineer
- Senior PHP/Laravel Developer: Your Dream Work Environment
iPhone Photography School
- Senior Software Engineer
Remote or San Francisco
- Laravel Developer
Las Vegas, NV
- R&D Developer
- Full-Stack Developer