liangguifeng/sentry
最新稳定版本:v3.2.0-beta.1
Composer 安装命令:
composer require liangguifeng/sentry
包简介
The sentry component for Hyperf.
README 文档
README
The sentry component for Hyperf.
Installation
composer require friendsofhyperf/sentry
Publish Config File
php bin/hyperf.php vendor:publish friendsofhyperf/sentry
Enable Request Lifecycle
# config/autoload/server.php return [ // ... 'servers' => [ [ 'name' => 'http', 'type' => Server::SERVER_HTTP, 'host' => '0.0.0.0', 'port' => 9501, 'callbacks' => [ Event::ON_REQUEST => [Hyperf\HttpServer\Server::class, 'onRequest'], ], 'options' => [ 'enable_request_lifecycle' => true, ], ], ], // ... ];
Register Logger Handler
<?php return [ // ... 'sentry' => [ 'handler' => [ 'class' => FriendsOfHyperf\Sentry\SentryHandler::class, 'constructor' => [ 'level' => \Monolog\Logger::DEBUG, ], ], 'formatter' => [ 'class' => \Monolog\Formatter\LineFormatter::class, 'constructor' => [ 'format' => null, 'dateFormat' => null, 'allowInlineLineBreaks' => true, ] ], ], // ... ];
Annotation
<?php namespace App; use FriendsOfHyperf\Sentry\Annotation\Breadcrumb; class Foo { #[Breadcrumb(category: 'foo')] public function bar($a = 1, $b = 2) { return __METHOD__; } }
Trace
<?php # config/autoload/middleware.php return [ 'http' => [ FriendsOfHyperf\Sentry\Tracing\Middleware\TraceMiddleware::class => PHP_INT_MAX, ], // rpc // 'rpc' => [ // FriendsOfHyperf\Sentry\Tracing\Middleware\TraceMiddleware::class, // ], ];
Fix un-support native-curl
- Check
php --ri swoole |grep curl # curl-native => enabled
- Fix
composer require php-http/guzzle6-adapter # or composer require php-http/guzzle7-adapter
Sponsor
If you like this project, Buy me a cup of coffee. [ Alipay | WePay ]
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-23