Bugsnag Middleware for Cilex
The Bugsnag middleware for Cilex integrates into Cilex PHP applications., (*1)
Bugsnag captures errors in real-time from your web,
mobile and desktop applications, helping you to understand and resolve them
as fast as possible. Create a free account to start
capturing errors from your applications., (*2)
The Bugsnag middleware for Cilex supports Cilex 1.1+ and PHP 5.3+., (*3)
Installation
To get this middleware in to an existing project, the best way is to use
Composer., (*4)
-
Add bugsnag/bugsnag-cilex as a Composer dependency in your project's
composer.json file:, (*5)
{
"require": {
"evolution7/bugsnag-cilex": "*"
}
}
-
If you haven't already, download and install Composer:, (*6)
curl -sS https://getcomposer.org/installer | php
-
Install your Composer dependencies:, (*7)
php composer.phar install
-
Set up Composer's autoloader:, (*8)
require_once 'vendor/autoload.php';
You're done! See the example application below that demonstrates basic usage., (*9)
Example application
<?php
require_once __DIR__.'/vendor/autoload.php';
$app = new Cilex\Application();
$app->register(new Bugsnag\Cilex\Provider\BugsnagServiceProvider, array(
'bugsnag.options' => array(
'apiKey' => '066f5ad3590596f9aa8d601ea89af845'
)
));
$app->get('/hello/{name}', function($name) use($app) {
throw new Exception("Hello!");
return 'Hello '.$app->escape($name);
});
$app->run();
If you want to access the bugsnag client directly (for example, to configure it
or to send a crash report manually), you can use $app['bugsnag']., (*10)