nieTonfir/raygun-bundle

Symfony2扩展,用于集成mindscape/raygun4php

安装次数: 5,672

依赖: 0

建议者: 0

安全性: 0

星标: 1

关注者: 3

分支: 2

开放问题: 3

类型:symfony-bundle

v0.2.0 2016-11-02 10:16 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:47:40 UTC


README

Raygun4PHP 是一个 PHP 5.3+ 的 Raygun.io 提供商。 Raygun4js 是一个 Raygun.io 插件,用于JavaScript。此扩展将库与框架注册,并提供插件模板。

Latest Stable Version Latest Unstable Version License

安装

使用以下命令安装最新版本

$ 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