Laravel Tinker (Unofficial)
Run Laravel code directly in VS Code.
Color-coded output, execution history, and first-class Docker/Sail support.
Based on laravel-runner by Ali Raza Saleem.
Quick Start
1. Ctrl + Shift + P → "Laravel Tinker: Install"
2. Open .tinker/sample.php
3. Ctrl + Shift + R or click ▶ in the editor title bar
That's it. Output appears in a side panel with syntax highlighting.
Why this fork?
| Feature |
laravel-runner |
This extension |
| Color-coded output |
Yes |
Yes |
| Search & highlight |
Yes |
Yes |
| Stop execution |
Yes |
Yes |
| Custom PHP runtime (Sail, Docker) |
— |
Yes |
| Execution history (browse, restore) |
— |
Yes |
| Play/Stop in editor title bar |
— |
Yes |
| Per-workspace history isolation |
— |
Yes |
Docker & Sail support
Works out of the box with any PHP runtime. Just set your command in settings:
// Laravel Sail (recommended)
"laravelTinker.phpCommand": "docker-compose exec laravel.test php"
// Or via the sail script directly
"laravelTinker.phpCommand": "./vendor/bin/sail php"
// Any custom Docker setup
"laravelTinker.phpCommand": "docker-compose exec app php"
The extension handles path mapping automatically — no extra configuration needed.
Execution History
Every run is saved locally, scoped per workspace. Press Ctrl + Alt + H or click the clock icon to:
- Browse past executions with timestamps and duration
- Restore any previous output with one click
- View the script that produced each result
- Delete individual entries or clear all history
Configurable limits keep storage in check (default: 500 entries / 200 MB).
Settings
All settings live under laravelTinker.* in VS Code.
| Setting |
Default |
Description |
phpCommand |
php |
PHP command — php, docker-compose exec laravel.test php, ./vendor/bin/sail php, etc. |
playgroundFolder |
.tinker |
Folder where scripts are executed (relative to project root) |
appendOutput |
true |
Keep output from previous runs visible |
historyEnabled |
true |
Save executions to local history |
historyMaxEntries |
500 |
Maximum history entries to keep |
historyMaxSizeMb |
200 |
Maximum history storage in MB |
Keyboard Shortcuts
| Shortcut |
Action |
| Ctrl + Shift + R |
Run PHP file |
| Ctrl + Alt + H |
Show execution history |
| Ctrl + Alt + C |
Clear output |
| Ctrl + Alt + F |
Search output |
All shortcuts are customizable via VS Code keybindings.
FAQ
Will it touch my database?
Only if your code tells it to. The extension just runs your PHP file through Laravel's bootstrapper.
Does it work with Docker / Sail / remote containers?
Yes. Set laravelTinker.phpCommand to docker-compose exec laravel.test php for Sail projects. Path mapping is handled automatically.
Where is history stored?
In VS Code's workspace storage directory, isolated per project. Nothing is added to your git repository.
What platforms are supported?
macOS, Linux, Windows, WSL, and remote SSH.
Credits
Fork of laravel-runner by Ali Raza Saleem, with execution history, custom runtime support, and UI improvements.
License
MIT — Original copyright Ali Raza Saleem, modifications by mdrbx.