moriony/silex-sentry-provider

Sentry service provider for the Silex framwork.

Installs: 3 274

Dependents: 0

Stars: 5

Watchers: 1

Forks: 3

Language: PHP

1.0.4 2014-03-27 22:43 UTC

README

Build Status Coverage Status Dependency Status

Sentry client service provider for the Silex framwork.

Install via composer

Add in your composer.json the require entry for this library.

{
    "require": {
        "moriony/silex-sentry-provider": "1.0.*"
    }
}

and run composer install (or update) to download all files.

If you don't need development libraries, use composer install --no-dev or composer update --no-dev

Usage

Service registration

$app->register(new Moriony\Silex\Provider\SentryServiceProvider, array(
    'sentry.options' => array(
        'dsn' => 'http://public:secret@example.com/1',
        // ... and other sentry options
    )
));

Here you can find other sentry options.

Exception capturing

$app->error(function (\Exception $e, $code) use($app) {
    // ...
    $client = $app['sentry'];
    $client->captureException($e);
    // ...
});

Error handler registration

Yoc can install error handlers and shutdown function to catch fatal errors

// ...
$errorHandler = $app['sentry.error_handler'];
$errorHandler->registerExceptionHandler();
$errorHandler->registerErrorHandler();
$errorHandler->registerShutdownFunction();
// ...

Resources