Vento-Nuenenen/UploadNow

Setup Airbrake for your PHP application

Closed this issue · 0 comments

Installation

Install Airbrake using Composer by running the following command from your project's directory:

composer require airbrake/phpbrake

Example Usage

Copy the following configuration snippet into your PHP app. It shows how to initialize Airbrake and register the instance as an error handler:

(You can find your project ID and API KEY with your project's settings):

$notifier = new Airbrake\Notifier(array(
    'projectId' => <Your project ID>,
    'projectKey' => '<Your project API KEY>'
));

Airbrake\Instance::set($notifier);

$handler = new Airbrake\ErrorHandler($notifier);
$handler->register();

To send a test error, you can call Airbrake directly like in this try/catch example:

try {
    throw new Exception('hello from phpbrake');
} catch(Exception $e) {
    Airbrake\Instance::notify($e);
}

Framework integrations

Going further

Check out our official GitHub repo for info on additional features like: