orkin / zend-expressive-sentry
为 Zend Expressive 提供的 Sentry 错误记录
0.1.3
2019-04-13 12:47 UTC
Requires
- psr/container: ^1.0
- sentry/sentry: ^1.7
- zendframework/zend-stratigility: ^3.0
This package is not auto-updated.
Last update: 2024-09-29 06:31:03 UTC
README
这是一个为 Zend Expressive 快速添加的插件,允许它向 Sentry 报告错误。
配置说明
将类 \Stickee\Sentry\ConfigProvider
添加到您的配置聚合中
例如:
<?php use Zend\ConfigAggregator\ArrayProvider; use Zend\ConfigAggregator\ConfigAggregator; use Zend\ConfigAggregator\PhpFileProvider; $cacheConfig = [ 'config_cache_path' => 'data/config-cache.php', ]; $aggregator = new ConfigAggregator( [ \Stickee\Sentry\ConfigProvider::class, // Include cache configuration new ArrayProvider($cacheConfig), // Default App module config \App\ConfigProvider::class, // Load application config in a pre-defined order in such a way that local settings // overwrite global settings. (Loaded as first to last): // - `global.php` // - `*.global.php` // - `local.php` // - `*.local.php` new PhpFileProvider('config/autoload/{{,*.}global,{,*.}local}.php'), // Load development config if it exists new PhpFileProvider('config/development.config.php'), ], $cacheConfig['config_cache_path'] ); return $aggregator->getMergedConfig();
这将自动将 Sentry 添加为错误监听器。
您可以通过在配置文件中定义它来配置 DSN - 我们建议将 config/sentry.global.php.dist
复制到您的应用程序的 config/autoload
中,并将其重命名为 sentry.global.php
- 添加您的 DSN(或设置环境变量)即可完成所有操作!