nieTonfir/ raygun-bundle
Symfony2扩展,用于集成mindscape/raygun4php
v0.2.0
2016-11-02 10:16 UTC
Requires
- php: >=5.3.9
- mindscape/raygun4php: ~1.6
- monolog/monolog: ~1.8
- symfony/config: ~2.7|~3.0
- symfony/dependency-injection: ~2.7|~3.0
- symfony/http-kernel: ~2.7|~3.0
- twig/twig: ~1.23|~2.0
Requires (Dev)
- phpunit/phpunit: ~3.7
- symfony/yaml: ~2.3|~3.0
README
Raygun4PHP 是一个 PHP 5.3+ 的 Raygun.io 提供商。 Raygun4js 是一个 Raygun.io 插件,用于JavaScript。此扩展将库与框架注册,并提供插件模板。
安装
使用以下命令安装最新版本
$ composer require nietonfir/raygun-bundle
配置
在parameters.yml中添加您的raygun api-key
# app/config/parameters.yml parameters: […] raygun_api_key: <your_raygun_api-key>
使用以下配置更新config.yml
# app/config/config.yml nietonfir_raygun: api_key: %raygun_api_key%
启用此扩展
// app/AppKernel.php $bundles = [ […] new Nietonfir\RaygunBundle\NietonfirRaygunBundle(), ];
基本用法
在config_prod.yml中将raygun monolog处理器注册为第一个monolog处理器。
# app/config/config_prod.yaml monolog: handlers: raygun: type: service id: raygun.handler main: type: fingers_crossed action_level: error handler: nested
要使用 JavaScript客户端,请根据raygun文档在模板中指定位置包含捆绑视图。 NietonfirRaygunBundle:Static:raygun-js.html.twig
提供javascript客户端,而 NietonfirRaygunBundle::setup.html.twig
进行配置,例如。
{# snip #} {% include 'NietonfirRaygunBundle:Static:raygun-js.html.twig' %} </head> <body> {# snip #} {% include 'NietonfirRaygunBundle::setup.html.twig' %} </body>
如果您想覆盖模板的任何部分,可以使用默认的Symfony机制。一个全局twig参数(raygun_api_key
)由一个自定义的Twig_Extension
提供,该扩展提供API密钥。可以通过设置或向模板传递名为enable_pulse
的布尔变量来启用Raygun pulse。
{% include 'NietonfirRaygunBundle::setup.html.twig' with {'enable_pulse': true} only %}
配置参考
# app/config/config.yml nietonfir_raygun: api_key: %raygun_api_key% # Your Raygun API key, available under "Application Settings" in your Raygun account. async: true # Sets the [async configuration option](https://github.com/MindscapeHQ/raygun4php#sending-method---asyncsync) on the Raygun client. debug_mode: false # Sets the [debug configuration option](https://github.com/MindscapeHQ/raygun4php#debug-mode) on the Raygun client. ignore_404: false # Whether to send 404 exceptions (NotFoundHttpException) to Raygun