Sentry client service provider for the Silex framwork.
Add in your composer.json
the require entry for this library.
{
"require": {
"moriony/silex-sentry-provider": "~2.0.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
$app->register(new Moriony\Silex\Provider\SentryServiceProvider, array(
'sentry.options' => array(
'dsn' => 'http://public:[email protected]/1',
// ... and other sentry options
)
));
Here you can find other sentry options.
$app->error(function (\Exception $e, $code) use($app) {
// ...
$client = $app['sentry'];
$client->captureException($e);
// ...
});
Yoc can install error handlers and shutdown function to catch fatal errors
// ...
$errorHandler = $app['sentry.error_handler'];
$errorHandler->registerExceptionHandler();
$errorHandler->registerErrorHandler();
$errorHandler->registerShutdownFunction();
// ...