ahmadwaleed / laravel-blanket
一个包裹Laravel HTTP客户端的毯子,并提供仪表盘以访问日志、重试和调试HTTP请求。
v1.2.0
2021-09-30 17:38 UTC
Requires
- php: 8.0.*
- ext-json: *
- guzzlehttp/guzzle: ^7.3
- laravel/framework: ^8.50
Requires (Dev)
- brianium/paratest: ^6.2
- friendsofphp/php-cs-fixer: ^3.0
- nunomaduro/collision: ^5.3
- orchestra/testbench: ^6.15
- phpunit/phpunit: ^9.3
- vimeo/psalm: ^4.4
README
查看Laravel应用程序中HTTP客户端请求的仪表盘
Laravel Blanket是一个包裹Laravel HTTP客户端请求并提供请求和响应日志的包,还可以从仪表盘重试任何请求等...
免责声明
这是一个具有强烈个人观点的有趣项目,它提供了一个非常简单的Web界面和日志监控。如果您需要高级监控工具,请考虑尝试Debugbar、Sentry和Bugsnag。
实时演示
请在此处查看演示,了解更多选项和功能...
截图
要求
- PHP >= 8.0
- Laravel >= 8.45
安装
您可以通过composer安装此包
composer require ahmadwaleed/laravel-blanket
该包将自动注册服务提供者。
安装Blanket后,使用blanket:wrap Artisan命令发布其资产。
php artisan blanket:wrap
此包包含一个迁移来存储所有发出的HTTP客户端请求。您可以使用以下方法发布迁移文件
php artisan vendor:publish --provider="Ahmadwaleed\Blanket\BlanketServiceProvider" --tag="blanket-migrations"
运行迁移
php artisan migrate
可选地,您可以发布blanket配置文件
php artisan vendor:publish --provider="Ahmadwaleed\Blanket\BlanketServiceProvider" --tag="blanket-config"
这是要发布的配置文件的内容,将作为config/blanket.php
发布
return [ /* |-------------------------------------------------------------------------- | Dashboard Enabled |-------------------------------------------------------------------------- | | Here you can specify whether to show dashboard or not. | */ 'enabled' => env('BLANKET_ENABLED', true), /* |-------------------------------------------------------------------------- | Hide Sensitive Data |-------------------------------------------------------------------------- | | Here you can specify the fields which might contain sensitive data, those | fields will hidden when saving logs. You can also specify nested keys in | config. Example: | 'response' => [ | 'client.id', | 'client.secret', | ], */ 'hide_sensitive_data' => [ 'headers' => [ 'Authorization', 'php-auth-pw', ], 'request' => [ 'password', 'password_confirmation', ], 'response' => [] ], /* |-------------------------------------------------------------------------- | Blanket Path |-------------------------------------------------------------------------- | | This is the URI path where Blanket will be accessible from. Feel free | to change this path to anything you like. | */ 'path' => env('BLANKET_PATH', 'blanket'), /* |-------------------------------------------------------------------------- | Blanket Route Middleware |-------------------------------------------------------------------------- | | These middleware will be assigned to every Blanket route, giving you | the chance to add your own middleware to this list or change any of | the existing middleware. Or, you can simply stick with this list. | */ 'middlewares' => [ // 'web', \Ahmadwaleed\Blanket\Http\Middlewares\Authorize::class, ], /* |-------------------------------------------------------------------------- | Log Response limit |-------------------------------------------------------------------------- | | This is maximum limit blanket is allowed to log response content, | if response content exceed this limit the response should be purged. | The default limit is 64 KB which is max limit, feel free to set lower limit. | */ 'log_response_limit' => env('BLANKET_RESPONSE_LIMIT', 64), /* |-------------------------------------------------------------------------- | Logs Per Page |-------------------------------------------------------------------------- | | How many logs should be fetched per page for dashboard, setting this option | to a big number may reduce dashboard performance. | */ 'logs_per_page' => env('BLANKET_LOGS_PER_PAGE', 100), /* |-------------------------------------------------------------------------- | Prune Blanket Logs Duration |-------------------------------------------------------------------------- | | Duration in which blanket logs will be deleted periodically | that are no longer needed. You should schedule the model:prune | Artisan command in your application's App\Console\Kernel class. | You are free to specify the appropriate interval here at which | this command should be run: | ``` | $schedule->command('model:prune', [ | '--model' => [Ahmadwaleed\Blanket\Models\Log::class], | ])->daily(); | */ 'prune_logs_duration' => env('PRUNE_LOGS_DURATION', now()->subMonth()), ];
致谢
许可
MIT许可(MIT)。有关更多信息,请参阅许可文件。