chrisshick/cakephp-airbrake

A CakePHP 3.x plugin to use Airbrake for errors and exceptions

Installs: 3 914

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 2

Forks: 11

Type:cakephp-plugin

1.0.3 2015-02-15 22:09 UTC

This package is auto-updated.

Last update: 2024-11-16 08:22:51 UTC


README

A plugin to seamlessly integrate Airbrake with CakePHP 3 for errors and exceptions.

Installation via Composer

composer require chrisshick/cakephp-airbrake

Setup

You don't have to enable the Plugin because it uses an error handler. Therefore, all you have to do is replace this line in the app/Config/bootstrap.php :

(new ErrorHandler(Configure::read('Error')))->register();

with this line:

(new \chrisShick\AirbrakeCake\Error\AirbrakeHandler(Configure::consume('Error')))->register();

Then, set up the configuration in the app/Config/app.php file:

 'AirbrakeCake'=> [
        'apiKey'=>'<YOUR AIRBRAKE API KEY>',
        'options'=>[],
        'debugOption'=>false
  ]

#Configuration explained

The configuration takes the following keys:

  'apiKey', 'options', 'debugOption'

The apiKey is the api key that Airbrake generates for you.

The options array is the additional Airbrake parameters you want to add. You can view the additional parameters here: PHPAirbrake

The debugOption key expects a true or false value that lets you set whether or not you want to log exceptions and errors when debug is on or off. If you want to log the errors to Airbrake when debug is on then set the debugOption key to true.