Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Web Tinker

Laravel Web Tinker Laravel Package

spatie/laravel-web-tinker

Adds a browser route to your Laravel app for running Artisan tinker without the terminal. Includes light and dark modes, but executes arbitrary code, so use it only as a dev dependency and never in production or with real data.

View on GitHub
Deep Wiki
Context7

spatie/laravel-web-tinker brings Artisan's tinker command to your browser, adding a dedicated route where you can run PHP code against your Laravel application. It's ideal for quick experiments and avoids the copy/paste friction of terminal tinkering. Install it as a dev dependency, publish the assets, and open the route—optionally publishing the config to customize access.

  • Browser REPL for executing arbitrary PHP in your app
  • Light and dark themes for comfortable use
  • Configurable route and middleware via config/web-tinker.php
  • Publishable assets and config through Artisan commands
  • Dev-only installation via Composer

⚠️ This package runs arbitrary code—never use it in production.

Frequently asked questions about Laravel Web Tinker
How do I install spatie/laravel-web-tinker in my Laravel application?
Install it as a dev dependency with composer require spatie/laravel-web-tinker --dev, then run php artisan web-tinker:install to publish the frontend assets. The install is complete at that point: there are no migrations, no external services and no credentials to configure. If you want to tweak the defaults, publish the config file with php artisan vendor:publish --provider="Spatie\WebTinker\WebTinkerServiceProvider" --tag="config".
Is spatie/laravel-web-tinker safe to run in production?
No. The package executes arbitrary PHP with the full privileges of your application process, which means it can read environment secrets, query the database and touch the filesystem or outbound network. Installing with --dev keeps it out of your production artifacts, and by default the route is only enabled when APP_ENV is local. Never enable it on production or on any environment that handles real-world data.
Which Laravel and PHP versions does spatie/laravel-web-tinker support?
The changelog shows coverage for Laravel 10, 11, 12 and 13, and PHP 8 or higher has been required since version 1.7.7. Spatie tends to ship framework support in minor releases, so check the Composer constraints on Packagist before a major upgrade. Because the package is pulled in with --dev, it will not block a production deploy even if you lag behind.
How do I change the URL path where the web tinker page is available?
Publish the config file with the web-tinker config tag, then edit the path key in config/web-tinker.php. The package registers its own route with the middleware it needs, so you do not have to add anything to your routes files. Changing the default path is a reasonable extra hurdle, but it is not a substitute for the Gate or middleware controls.
How do I restrict who can access the web tinker route?
The package ships three layers you can use: the enabled flag, which defaults to APP_ENV === 'local'; a viewWebTinker Gate; and a middleware key in the config. Replace or extend that middleware stack with auth, an IP allowlist, VPN-only ingress or basic auth if you need network-level controls. The middleware key is the main governance lever, so decide who owns it before enabling the route anywhere shared.
What is the difference between laravel-web-tinker and php artisan tinker?
Both run on PsySH, the engine behind php artisan tinker, so the code you execute behaves the same way. The difference is purely ergonomic: web tinker gives you a browser page where results stay visible, so you can make a few edits and re-run without copy/pasting back and forth between an editor and a terminal. It also includes light and dark themes, but it is not a debugger, profiler or step-through tool.
Can I use web tinker on staging or a preview environment where APP_ENV is not local?
By default the route is disabled outside local, so staging and preview hosts will not expose it unless you deliberately change the enabled setting. If you do enable it there, remember that staging data is often production-like, so pair it with the viewWebTinker Gate, restrictive middleware and network controls such as an IP allowlist. Add a CI test that asserts the route is not registered in production builds rather than relying on APP_ENV alone. Treat the answer as a documented policy decision, not a per-developer judgement call.
Does spatie/laravel-web-tinker work with Laravel Octane or Swoole?
There is no explicit validation for long-lived workers, so treat Octane and Swoole as untested territory. PsySH shell state would persist inside a resident worker, which raises the possibility of state bleeding between requests and gradual memory growth. If you run Octane, test for both problems explicitly or keep tinkering in the terminal instead.
How do I customize how web tinker formats and displays output?
Bind your own implementation of the OutputModifier interface through the output_modifier key in config/web-tinker.php. That interface is the package's only real extension point, and it is limited to formatting the output that comes back from PsySH. Anything beyond presentation, such as adding commands or changing execution behaviour, means forking the package.
What are the alternatives to spatie/laravel-web-tinker?
The closest equivalents are php artisan tinker over SSH, which is already part of Laravel, and Tinkerwell, a desktop app that connects to your project without exposing a route. For inspection rather than execution, Laravel Telescope or Clockwork cover request, query and log debugging. Web tinker's niche is a local-only convenience page, so if you need remote access, a terminal session or a secured tunnel is usually the better trade-off.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
thomas-0816/doctrine-dbal-duckdb
moyisoft/laravel-admin
oxygen/mod-pages
oxygen/mod-import-export
oxygen/mod-media
ksoft/laravel-contentbuilderjs
ourgoldpackages/exchange
mikkimike/laravel-exchange1c
wandesnet/mercadopago-laravel
tsfcorp/email
larafony/core
laravel-enso/currencies
tartan/laravel-online-payment
gam/laravel-sat-catalogs
cloudcreativity/laravel-stripe
abdulelahragih/querybuilder
wedevbr/celcoin-laravel
surazdott/nepali-date
devsquad-cockpit/laravel
coding-socks/laravel-upload-handler