faridcs / laravel-apm
Laravel APM For Elasticsearch
4.4
2018-12-31 08:02 UTC
Requires
- php: >=7.0
- illuminate/database: >=5.2
- illuminate/http: >=5.2
- illuminate/routing: >=5.2
- illuminate/support: >=5.2
- philkra/elastic-apm-php-agent: ^6.4
- ramsey/uuid: ^3.8
Requires (Dev)
- phpunit/phpunit: ~4.5
README
PHP Elastic APM for Laravel 此包与laravel >= 5.2兼容
安装
composer require faridcs/laravel-apm
提供者和别名
将此行添加到 config/app.php 文件中的提供者和别名数组中
'providers' => [ /* * Laravel Framework Service Providers... */ // ... more provider faridcs\ApmLaravel\Providers\ElasticApmServiceProvider::class, ], 'aliases' => [ // more aliases 'ElasticApm' => faridcs\ApmLaravel\Facades\ElasticApm::class, ],
配置
php artisan vendor:publish --provider="alopeyk\ApmLaravel\Providers\ElasticApmServiceProvider" --tag="config"
中间件
在 app/Http/Kernel.php 中注册中间件
protected $middleware = [ // ... more middleware \faridcs\ApmLaravel\Middleware\RecordTransaction::class, ];
错误/异常处理
Laravel
在 app/Exceptions/Handler 中,向 report 方法添加以下内容
ElasticApm::captureThrowable($exception); ElasticApm::send();
确保在文件顶部导入外观
use ElasticApm;