moriony / silex-sentry-provider
Sentry service provider for the Silex framwork.
Installs: 70 297
Dependents: 1
Suggesters: 0
Security: 0
Stars: 9
Watchers: 2
Forks: 4
Open Issues: 0
Requires
- php: >=5.6
- pimple/pimple: ~3.0
- sentry/sentry: ~1.1
Requires (Dev)
- codeclimate/php-test-reporter: ~0.3.2
- phpunit/phpunit: ~4.8
README
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": "~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
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(); // ...