evonext / tracy
一个用于集成 Nette Tracy Debugger 的 EvoNext CMS 包
1.1.2
2022-12-27 14:25 UTC
Requires
- php: ^7.4|^8.0
- illuminate/contracts: ^8.0|^9.0
- illuminate/database: ^8.0|^9.0
- illuminate/routing: ^8.0|^9.0
- illuminate/session: ^8.0|^9.0
- illuminate/support: ^8.0|^9.0
- illuminate/view: ^8.0|^9.0
- tracy/tracy: >=2.4,<2.9
Requires (Dev)
- mockery/mockery: ^1.0
- nesbot/carbon: ^1.20|^2.0
- orchestra/testbench: ^6.23|^7.0
- phpunit/phpunit: ^8.0|^9.0
This package is not auto-updated.
Last update: 2024-10-01 23:11:59 UTC
README
更好的异常处理
特性
- 错误和异常的可视化
- 调试条(自 v1.5.6 支持 AJAX)
- 异常堆栈跟踪包含所有方法参数的值。
安装
要获取 Laravel 异常的最新版本,只需使用 Composer 需求项目。
composer require evonext/tracy --dev
当然,您也可以选择手动更新您的 require
块并运行 composer update
。
{ "require-dev": { "evonext/tracy": "^1.0" } }
在 config/app.php
中包含服务提供者。服务提供者对于生成 artisan 命令是必需的。
'providers' => [ ... EvoNext\Tracy\TracyServiceProvider::class, ... ];
如果您看到路由 tracy.bar
未定义,请运行一次 artisan route:clear
。
artisan route:clear
配置
可以使用环境变量更改基本设置
TRACY_ENABLED=true # true | false | 'manager' | 'web' TRACY_SHOW_BAR=true # true | false TRACY_EXCEPTION=true # true | false TRACY_MGR_TOP_FRAME=false # true | false
发布配置
如果您需要更改其他设置,请发布配置。
php artisan vendor:publish --provider="EvoNext\Tracy\TracyServiceProvider"
/config
目录将包含 tracy.php
文件,您可以按需更改。
return [ /* Activate tracy |-------------------------------------------------------------------------- | Available values: | true – Enable for any context | false – Disable for any context | 'manager' – Enable only for manager context (admin area) | 'web' – Enable only for web context (public area) |-------------------------------------------------------------------------- */ 'enabled' => env('TRACY_ENABLED', env('APP_DEBUG') === true), /* Show bar |-------------------------------------------------------------------------- */ 'showBar' => env('TRACY_SHOW_BAR', env('APP_ENV') !== 'production'), /* Show exceptions |-------------------------------------------------------------------------- */ 'showException' => env('TRACY_EXCEPTION', true), /* The URL prefix for the manager dashboard |-------------------------------------------------------------------------- */ 'managerPrefix' => 'admin', /* The URL prefix for a frame top level the manager dashboard |-------------------------------------------------------------------------- */ 'managerTopRoute' => 'main', /* If true tracy shown bar in a frame top level | instead pages frames in the manager context |-------------------------------------------------------------------------- */ 'enabledInTopFrame' => env('TRACY_MGR_TOP_FRAME', false), 'route' => [ 'prefix' => 'tracy', 'as' => 'tracy.', ], 'accepts' => [ 'text/html', ], 'appendTo' => 'body', 'editor' => 'editor://%action/?file=%file&line=%line&search=%search&replace=%replace', 'maxDepth' => 4, 'maxLength' => 1000, 'scream' => true, 'showLocation' => true, 'strictMode' => true, 'editorMapping' => [], 'panels' => [ 'routing' => true, 'database' => true, 'view' => true, 'event' => false, 'session' => true, 'request' => true, 'auth' => true, 'html-validator' => false, ], ];
编辑链接
见 https://tracy.nette.org/en/open-files-in-ide
调试条
图片可点击
自定义身份验证
// app/Providers/AppServiceProvider.php
namespace App\Providers;
use Recca0120\LaravelTracy\BarManager;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function boot(BarManager $barManager)
{
$barManager->get('auth')->setUserResolver(function() {
return [
'id' => 'xxx',
'username' => 'xxx',
...
];
});
}
}