jaguarsoft / laravel-debugbar
通过中间件处理Debugbar启用
5.2.0
2022-05-07 21:06 UTC
Requires
- php: ^5.3.9 || ^7.0 || ^8.0
This package is auto-updated.
Last update: 2024-09-24 08:51:51 UTC
README
此包允许您在配置已禁用的情况下按需启用Debugbar。
安装
composer require jaguarsoft/laravel-debugbar
配置
config/app.php
'providers' => [ /** **/ // Barryvdh\Debugbar\ServiceProvider::class, JaguarSoft\LaravelDebugbar\Provider\DebugbarServiceProvider::class, ], 'aliases' => [ /** **/ 'Debugbar' => Barryvdh\Debugbar\Facade::class, ],
使用
加载对所有启用
DEBUGBAR_ENABLED=true
加载对所有禁用,并在中间件之后启用
DEBUGBAR_ENABLED=false
当 APP_DEBUG=true 时加载启用
DEBUGBAR_ENABLED=null
中间件
public function handle($request, Closure $next){ if(/* your validation*/){ \Debugbar::enable(); } return $next($request); }
示例中间件: https://gist.github.com/laurenceHR/911050c675eb5a1d28b761b61b3b25a0
在Laravel 5.2, 5.3, 5.4中使用并测试。在Laravel 5.5中不需要,因为"barryvdh/laravel-debugbar"版本"~3.4.2"已包含此功能。