noone-silent / phalcon-sentry
Phalcon 框架的 Sentry 集成
v1.0.7
2024-08-20 04:48 UTC
Requires
- php: >= 8.0
- ext-phalcon: ^5.0
Requires (Dev)
- codeception/codeception: ^5.1.2
- codeception/module-phalcon5: ^v2.0.1
- friendsofphp/php-cs-fixer: ^3.58
- phalcon/ide-stubs: ^v5.0.0
- phpstan/phpstan: 1.10.*
- sentry/sentry: ^4.7
Suggests
- sentry/sentry: Use version 4.* for best compatility.
README
此目录包含 Phalcon Sentry 集成的 PHP 源代码。
要求
- PHP 8.0 或更高版本
- Composer
- Phalcon 框架 版本 5.0.0 或更高
安装
composer install noone-silent/phalcon-sentry
使用方法
复制 config/sentry.php
下找到的 Sentry 配置。
提示
建议您在设置服务提供者之前设置事件管理器。
$di->set('eventsManager', new \Phalcon\Events\Manager(), true);
将以下代码添加到您的入口脚本
$di->register( new Phalcon\Sentry\ServiceProvider( $pathTo . '/config/sentry.php' ) );
如果您使用 Volt 模板引擎,可以使用提供的助手在脚本和标签中放置脚本。在 config/sentry.php
中可以配置 sentryHelper
的名称。
// Add this between your <head></head> {{ sentryHelper.getMetaTag() }}
// Add this right before your </body> {{ sentryHelper.getScript() }}
您还可以向 getScript()
助手传递选项
{{ sentryHelper.getScript( [ 'Sentry.browserTracingIntegration()', 'Sentry.replayIntegration()', 'Sentry.feedbackIntegration()' ], static_url('/js/bundle.tracing.replay.feedback.min.js') ) }}
[!注意] 如果您不自行托管 Sentry 浏览器脚本,您应将
browser.sentry-cdn.com
添加到您的允许script-src
中。您可以在这里了解更多信息: Sentry 内容安全策略