Installing Airbrake in a PHP application

PHPBrake

Features

PHPBrake is the official Airbrake PHP notifier. PHPBrake includes a many useful features that give you control over when and what you send to Airbrake, you can:

Installation

Visit our official GitHub repository for full installation instructions and configuration options.

composer require airbrake/phpbrake

Quickstart

// Create new Notifier instance.
$notifier = new Airbrake\Notifier(array(
    'projectId' => 12345, // FIX ME
    'projectKey' => 'abcdefg', // FIX ME
));

// 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);
}