spatie/laravel-web-tinker
Composer 安装命令:
composer require spatie/laravel-web-tinker
包简介
Artisan Tinker in your browser
README 文档
README
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.
In case light hurts your eyes, there's a dark mode too.
Support us
We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.
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. We publish all received postcards on our virtual postcard wall.
🚨 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
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
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
Should you want to run this in another environment (we do not recommend this), there are two steps you must perform.
- You must register a
viewWebTinkerability. A good place to do this is in theAuthServiceProviderthat ships with Laravel.
public function boot() { $this->registerPolicies(); Gate::define('viewWebTinker', function ($user = null) { // return true if access to web tinker is allowed }); }
- You must set the
enabledvariable in theweb-tinkerconfig file totrue.
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
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you've found a bug regarding security please mail security@spatie.be instead of using the issue tracker.
Credits
This package was inspired by and uses code from the nova-tinker-tool package by Marcel Pociot.
License
The MIT License (MIT). Please see License File for more information.
spatie/laravel-web-tinker 适用场景与选型建议
spatie/laravel-web-tinker 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 4.08M 次下载、GitHub Stars 达 1.22k, 最近一次更新时间为 2019 年 02 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「debug」 「development」 「laravel」 「spatie」 「Tinker」 「web-tinker」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 spatie/laravel-web-tinker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 spatie/laravel-web-tinker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 spatie/laravel-web-tinker 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Debug your SimpleBus EventBus and CommandBus
nice output for debug functions for PHP 5.3
Debugging a problem and need to login as one of your customers? This allows you to authenticate as any of your customers.
Library with classes to help you do batch.
Analysis module for finding problematical shop data.
Twig extensions for Tracy Debugger
统计信息
- 总下载量: 4.08M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1222
- 点击次数: 22
- 依赖项目数: 12
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-08