Skip to content

A symfony bundle for integrating the raygun php provider and javascript plugin.

License

Notifications You must be signed in to change notification settings

nietonfir/RaygunBundle

Repository files navigation

RaygunBundle

Raygun4PHP is a Raygun.io provider for PHP 5.3+. Raygun4js is a is a Raygun.io plugin for JavaScript. This bundle registers the library with the framework and provides a twig template for the plugin.

Latest Stable Version Latest Unstable Version License

Installation

Install the latest version with

$ composer require nietonfir/raygun-bundle

Configuration

Add your raygun api-key in parameters.yml:

# app/config/parameters.yml
parameters:
    […]
    raygun_api_key: <your_raygun_api-key>

Update config.yml with the following configuration:

# app/config/config.yml
nietonfir_raygun:
    api_key: %raygun_api_key%

Enable the bundle:

// app/AppKernel.php
$bundles = [
    […]
    new Nietonfir\RaygunBundle\NietonfirRaygunBundle(),
];

Basic Usage

Register the raygun monolog handler in config_prod.yml as the first monolog handler.

# app/config/config_prod.yaml
monolog:
    handlers:
        raygun:
            type: service
            id:   raygun.handler
        main:
            type:         fingers_crossed
            action_level: error
            handler:      nested

To use the JavaScript client include the bundled views in your template at their designated places according to the raygun documentation. NietonfirRaygunBundle:Static:raygun-js.html.twig provides the javascript client and NietonfirRaygunBundle::setup.html.twig configures it, e.g.:

{# snip #}
{% include 'NietonfirRaygunBundle:Static:raygun-js.html.twig' %}
</head>
<body>

{# snip #}
{% include 'NietonfirRaygunBundle::setup.html.twig' %}
</body>

If you wish to override any part of the templates you can use the default Symfony mechanisms. A global twig parameter (raygun_api_key) is exposed by a custom Twig_Extension that provides the API key. Raygun pulse can be enabled by either setting or passing a truthy variable named enable_pulse to the template:

{% include 'NietonfirRaygunBundle::setup.html.twig' with {'enable_pulse': true} only %}

Configuration Reference

# 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

About

A symfony bundle for integrating the raygun php provider and javascript plugin.

Resources

License

Stars

Watchers

Forks

Packages

No packages published