marcopollacci / sentryexpressive
连接 Zend Expressive 框架到 Sentry 的实用工具
1.0
2019-06-19 07:17 UTC
Requires
- php: ^7.1
- sentry/sdk: ^2.0
This package is auto-updated.
Last update: 2024-09-20 00:23:26 UTC
README
Sentry Delegator for Zend Expressive Framework
使用 Composer 安装
composer require marcopollacci/sentryexpressive
用法
- 在配置文件中设置 sentry 令牌和 dsn(如果没有提供配置,则不会向 Sentry 发送异常)。例如
return [ 'sentry' => [ 'dsn' => 'https://<your url>>/<your id>', 'environment' => 'produzione' #optional ] ];
- 享受它:D!
try / catch 语句中的附加用法
代码示例
try { throw new \Exception('something'); }catch(\Exception $e){ \Sentry\captureException($e); /* something else you want */ }