merqlove/airbrake-silex-service-provider

This allows use php-airbrake module as a service in Silex.

dev-master 2013-10-07 15:48 UTC

This package is not auto-updated.

Last update: 2024-04-22 13:37:18 UTC


README

Airbrake service provider for Silex and php-airbrake.

Installation

composer.json:

{
    "require": {
      "dbtlr/php-airbrake"    : "dev-master",
      "merqlove/airbrake-silex-service-provider"    : "dev-master"
    }
}
$ wget http://getcomposer.org/composer.phar
$ php composer.phar install

Registering

use Merqlove\Silex\Provider\AirbrakeServiceProvider;

$app->register(new AirbrakeServiceProvider(), array(
    'airbrake.api_key' => 'SOME_KEY', //required
    'airbrake.options' => array(
      'secure' => false,
    ), // optional
));

Using

// Send just an error message
$app['airbrake']->notifyOnError('My error message');

// Send an exception that may have been generated or caught.
try {
    throw new Exception('This is my exception');
} catch (Exception $exception) {
    $app['airbrake']->notifyOnException($exception);
}

License

The Airbrake Silex Extension is licensed under the MIT license.