PHPackages                             nadir2k/laravel-web-tinker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. nadir2k/laravel-web-tinker

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nadir2k/laravel-web-tinker
==========================

Artisan Tinker in your browser

063JavaScript

Since May 13Pushed 2y agoCompare

[ Source](https://github.com/nadirabbas/laravel-web-tinker)[ Packagist](https://packagist.org/packages/nadir2k/laravel-web-tinker)[ RSS](/packages/nadir2k-laravel-web-tinker/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Artisan Tinker in your browser
==============================

[](#artisan-tinker-in-your-browser)

[![Latest Version on Packagist](https://camo.githubusercontent.com/76bf8834922bfc0fb90d0c38cb2d02bbc45fa8e9ccefaa831f77f8b1e0184be2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c61726176656c2d7765622d74696e6b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-web-tinker)[![GitHub Workflow Status](https://camo.githubusercontent.com/2a8b964180e9b684b1851177fc7f09d820fe73ef8e39f61e523210875d743763/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d7765622d74696e6b65722f72756e2d74657374733f6c6162656c3d7465737473)](https://camo.githubusercontent.com/2a8b964180e9b684b1851177fc7f09d820fe73ef8e39f61e523210875d743763/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d7765622d74696e6b65722f72756e2d74657374733f6c6162656c3d7465737473)[![Total Downloads](https://camo.githubusercontent.com/68dd0fe85f7db0921cc00da82d1e5ef1a2e90eb3824193d57c0cce969ed64b94/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d7765622d74696e6b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-web-tinker)

Artisan's tinker command is a great way to tinker with your application in the terminal. Unfortunately running a few lines of code, making edits, and copy/pasting code can be bothersome. Wouldn't it be great to tinker in the browser?

This package will add a route to your application where you can tinker to your heart's content.

[![Web tinker light](https://camo.githubusercontent.com/0603f41a58c0c74d860aa2d4b47a06aea54c8ca1fbd8df30f6242221e09a7b94/68747470733a2f2f7370617469652e6769746875622e696f2f6c61726176656c2d7765622d74696e6b65722f6c696768742e706e67)](https://camo.githubusercontent.com/0603f41a58c0c74d860aa2d4b47a06aea54c8ca1fbd8df30f6242221e09a7b94/68747470733a2f2f7370617469652e6769746875622e696f2f6c61726176656c2d7765622d74696e6b65722f6c696768742e706e67)

In case light hurts your eyes, there's a dark mode too.

[![Web tinker dark](https://camo.githubusercontent.com/e0016af41658038bb7c85ffec02e62988e2cb721eadb3521dfa4784daf0d1343/68747470733a2f2f7370617469652e6769746875622e696f2f6c61726176656c2d7765622d74696e6b65722f6461726b2e706e67)](https://camo.githubusercontent.com/e0016af41658038bb7c85ffec02e62988e2cb721eadb3521dfa4784daf0d1343/68747470733a2f2f7370617469652e6769746875622e696f2f6c61726176656c2d7765622d74696e6b65722f6461726b2e706e67)

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/06995600dadbb4638373c56675913996c557f1be6fb04efbcca055095d4c7568/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d7765622d74696e6b65722e6a70673f743d31)](https://spatie.be/github-ad-click/laravel-web-tinker)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

🚨 A word to the wise 🚨
----------------------

[](#-a-word-to-the-wise-)

This package can run arbitrary code. Unless you know what you are doing, you should never install or use this in a production environment, or any environment where you handle real world data.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require spatie/laravel-web-tinker --dev
```

Next, you must publish the assets from this package by running this command.

```
php artisan web-tinker:install
```

Optionally, you can publish the config file of the package.

```
php artisan vendor:publish --provider="Spatie\WebTinker\WebTinkerServiceProvider" --tag="config"
```

This is the content that will be published to `config/web-tinker.php`

```
return [

    /*
     * The web tinker page will be available on this path.
     */
    'path' => '/tinker',

    /*
     * Possible values are 'auto', 'light' and 'dark'.
     */
    'theme' => 'auto',

    /*
     * By default this package will only run in local development.
     * Do not change this, unless you know what your are doing.
     */
    'enabled' => env('APP_ENV') === 'local',

   /*
    * This class can modify the output returned by Tinker. You can replace this with
    * any class that implements \Spatie\WebTinker\OutputModifiers\OutputModifier.
    */
    'output_modifier' => \Spatie\WebTinker\OutputModifiers\PrefixDateTime::class,

    /*
    * These middleware will be assigned to every WebTinker route, giving you the chance
    * to add your own middlewares to this list or change any of the existing middleware.
    */
    'middleware' => [
        Illuminate\Cookie\Middleware\EncryptCookies::class,
        Illuminate\Session\Middleware\StartSession::class,
        Spatie\WebTinker\Http\Middleware\Authorize::class,
    ],

    /*
     * If you want to fine-tune PsySH configuration specify
     * configuration file name, relative to the root of your
     * application directory.
     */
    'config_file' => env('PSYSH_CONFIG', null),
];
```

Usage
-----

[](#usage)

By default this package will only run in a local environment.

Visit `/tinker` in your local environment of your app to view the tinker page.

Authorization
-------------

[](#authorization)

Should you want to run this in another environment (we do not recommend this), there are two steps you must perform.

1. You must register a `viewWebTinker` ability. A good place to do this is in the `AuthServiceProvider` that ships with Laravel.

```
public function boot()
{
    $this->registerPolicies();

    Gate::define('viewWebTinker', function ($user = null) {
        // return true if access to web tinker is allowed
    });
}
```

2. You must set the `enabled` variable in the `web-tinker` config file to `true`.

Modifying the output
--------------------

[](#modifying-the-output)

You can modify the output of tinker by specifying an output modifier in the `output_modifier` key of the `web-tinker` config file. An output modifier is any class that implements `\Spatie\WebTinker\OutputModifiers\OutputModifier`.

This is how that interface looks like.

```
namespace Spatie\WebTinker\OutputModifiers;

interface OutputModifier
{
    public function modify(string $output = ''): string;
}
```

The default install of this package will use the `PrefixDataTime` output modifier which prefixes the output from Tinker with the current date time.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

This package was inspired by and uses code from the [nova-tinker-tool](https://github.com/beyondcode/nova-tinker-tool) package by [Marcel Pociot](https://github.com/mpociot).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity18

Early-stage or recently created project

 Bus Factor1

Top contributor holds 56.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b5167b4321c37e42c9415b0a31df7abd36924694c7e663db14b341532a520092?d=identicon)[nadirabbas](/maintainers/nadirabbas)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (138 commits)")[![rzv-me](https://avatars.githubusercontent.com/u/38325118?v=4)](https://github.com/rzv-me "rzv-me (17 commits)")[![willemvb](https://avatars.githubusercontent.com/u/1336390?v=4)](https://github.com/willemvb "willemvb (12 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (8 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![rubenvanassche](https://avatars.githubusercontent.com/u/619804?v=4)](https://github.com/rubenvanassche "rubenvanassche (8 commits)")[![Nielsvanpach](https://avatars.githubusercontent.com/u/10651054?v=4)](https://github.com/Nielsvanpach "Nielsvanpach (7 commits)")[![setkyar](https://avatars.githubusercontent.com/u/4435358?v=4)](https://github.com/setkyar "setkyar (5 commits)")[![eli-s-r](https://avatars.githubusercontent.com/u/64713921?v=4)](https://github.com/eli-s-r "eli-s-r (5 commits)")[![brendt](https://avatars.githubusercontent.com/u/6905297?v=4)](https://github.com/brendt "brendt (4 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (4 commits)")[![d13r](https://avatars.githubusercontent.com/u/236616?v=4)](https://github.com/d13r "d13r (3 commits)")[![ahmic](https://avatars.githubusercontent.com/u/13452362?v=4)](https://github.com/ahmic "ahmic (3 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (2 commits)")[![nadirabbas](https://avatars.githubusercontent.com/u/38838675?v=4)](https://github.com/nadirabbas "nadirabbas (2 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (2 commits)")[![chapeupreto](https://avatars.githubusercontent.com/u/834048?v=4)](https://github.com/chapeupreto "chapeupreto (2 commits)")[![emiliopedrollo](https://avatars.githubusercontent.com/u/6577541?v=4)](https://github.com/emiliopedrollo "emiliopedrollo (2 commits)")[![CraftLogan](https://avatars.githubusercontent.com/u/10950466?v=4)](https://github.com/CraftLogan "CraftLogan (1 commits)")[![tymondesigns](https://avatars.githubusercontent.com/u/1801923?v=4)](https://github.com/tymondesigns "tymondesigns (1 commits)")

### Embed Badge

![Health badge](/badges/nadir2k-laravel-web-tinker/health.svg)

```
[![Health](https://phpackages.com/badges/nadir2k-laravel-web-tinker/health.svg)](https://phpackages.com/packages/nadir2k-laravel-web-tinker)
```

###  Alternatives

[webit/eval-math

EvalMath

28838.7k5](/packages/webit-eval-math)[jdrieghe/array-helpers

A collection of convenience methods to deal with arrays in php. Somewhat inspired by Laravel array helpers.

17468.7k2](/packages/jdrieghe-array-helpers)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
