samuelnogueira / new-relic-middleware
0.7.1
2024-04-03 20:45 UTC
Requires
- php: ^7.3 || ^8.0
- mezzio/mezzio-router: ^3.1
- psr/http-server-middleware: ^1.0
Requires (Dev)
- guzzlehttp/psr7: 2.5.0
- phpstan/phpstan: 1.10.66
- phpunit/phpunit: 9.6.18
- squizlabs/php_codesniffer: 3.8.1
- vimeo/psalm: 4.30.0
Suggests
- ext-newrelic: Middleware will do nothing if this extension isn't loaded
README
PSR-15 中间件,用于 Mezzio 应用程序的 New Relic 仪表化。
⚠️ 在异步应用程序(例如 Swoole 协程)中无法正确工作 ⚠️
要求
- PHP ^7.3 或 ^8.0
- 一个 Mezzio 应用程序(以前称为 Zend Expressive)
安装
此包可以通过 Composer 以 samuelnogueira/zend-expressive-new-relic 的形式安装和自动加载。
composer require samuelnogueira/zend-expressive-new-relic
示例
<?php // config/pipeline.php use Samuelnogueira\ZendExpressiveNewRelic\Middleware\NewRelicMiddleware; use Samuelnogueira\ZendExpressiveNewRelic\Middleware\NewRelicTransactionNameMiddleware; use Mezzio\Router\Middleware\RouteMiddleware; use Mezzio\Application; return static function (Application $app): void { // (...) // Profiling middleware 2nd most outer middleware to profile everything if (extension_loaded('newrelic')) { $app->pipe(NewRelicMiddleware::class); } // (...) // Register the routing middleware in the middleware pipeline $app->pipe(RouteMiddleware::class); // Add more middleware here that needs to introspect the routing results; this // might include: // // - route-based authentication // - route-based validation // - etc. if (extension_loaded('newrelic')) { $app->pipe(NewRelicTransactionNameMiddleware::class); } // (...) };
MIT 许可证(MIT)。有关更多信息,请参阅 LICENSE。