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.
Learn MoreFiled in: Laravel Packages
- PHP Developer - Full time w/ benefits, US Only
Northern Virginia or Remote (US Only)
- Full Stack Developer
- Laravel API Developer
Las Vegas, NV (Must work on-site)
- Laravel Developer (Vue, SQL Server)
World Trade Organization
- Web Application Developer (Vue.js & Laravel)
Apero Creative Development
Join 31,000+ others and never miss out on new tips, tutorials, and more.