The Bugsnag middleware for Cilex integrates into Cilex PHP applications.
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.
The Bugsnag middleware for Cilex supports Cilex 1.1+ and PHP 5.3+.
To get this middleware in to an existing project, the best way is to use Composer.
-
Add
bugsnag/bugsnag-cilex
as a Composer dependency in your project'scomposer.json
file:{ "require": { "evolution7/bugsnag-cilex": "*" } }
-
If you haven't already, download and install Composer:
curl -sS https://getcomposer.org/installer | php
-
Install your Composer dependencies:
php composer.phar install
-
Set up Composer's autoloader:
require_once 'vendor/autoload.php';
You're done! See the example application below that demonstrates basic usage.
<?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']
.