Install Airbrake using Composer by running the following command from your project's directory:
composer require airbrake/phpbrake
Example Usage
This usage example details how to create a notifier instance, set a global notifier instance, register the error handler, and includes a snippet of some code that would report an exception to Airbrake (You can find your project ID and API KEY with your project's settings):
// Create new Notifier instance.
$notifier = new Airbrake\Notifier(array(
'projectId' => <Your project ID>,
'projectKey' => '<Your project API KEY>',
));
// Set global notifier instance.
Airbrake\Instance::set($notifier);
// Register error and exception handlers.
$handler = new Airbrake\ErrorHandler($notifier);
$handler->register();
// Somewhere in the app...
try {
throw new Exception('hello from phpbrake');
} catch(Exception $e) {
Airbrake\Instance::notify($e);
}
Going further
Check out our official GitHub repo for info on additional features like:
Installation
Install Airbrake using Composer by running the following command from your project's directory:
Example Usage
This usage example details how to create a notifier instance, set a global notifier instance, register the error handler, and includes a snippet of some code that would report an exception to Airbrake (You can find your project ID and API KEY with your project's settings):
Going further
Check out our official GitHub repo for info on additional features like: