Skip to content

sisfo/airbrake-php-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

Airbrake Notifier Client for PHP

This client is intended to be a drop-in library for communicating with the Airbrake Notifier API. Airbrake is a service that collects errors generated by other applications, and aggregates the results for review.

This client is maintained by Jonathan Azoff, under the courtesy of RentJuice Corp.

License and Terms

This client is freely distributed under the DBAD License. If you use this software, you agree to the terms governed by the license and you do so AT YOUR OWN RISK. RentJuice is not responsible for usage or other concerns with this library. If you have an issue, please feel free to use the official bug tracker.

Dependencies

In order to communicate with the Airbrake servers, the PHP client depends on a couple dependencies to be installed before running. In no particular order, these dependencies are:

  • cURL, to send HTTP requests to Airbrake
  • SimpleXML, to validate and parse XML

Getting Started

To get started, you must first ensure that the aforementioned dependencies are installed. Afterwards, you may run the provided example to verify that the dependencies are met and that your Airbrake account is set up correctly. In order to run the example, you will need to provide your API key; I found mine on the project dashboard:

Project Dashboard

If you are looking to jump right into things and reading code isn't your thing, here is the quick and dirty version:

# load the client
require('/airbrake.notifier.php');

# instantiate the notifier
$notifier = new AirbrakeNotifier($_YOUR_API_KEY);

# catch an error
try {

    # assuming you have an error...
    doSomethingBad();

} catch(Exception $e) {
    
    # track the error, and get back the Airrake ID for the notice
    $noticeId = $notifier->notifyException($e);

    # you can also be explicit...
    $trace = AirbrakeNotifier::getFixedTrace($e->getTrace());
    $noticeId = $notifier->notify('Something bad happened!', 'SomeExplicitError', $trace, array(
        'some_info' => 'both functions take an optional final parameter',
        'more_info' => 'which can be used to add extra information to the notice!',
        'note' => 'you can find this EXTRA_DATA of the params on Airbrake'
    ));

}

Special Thanks

This client would not be available if it weren't for the kind graces of the development team at RentJuice. RentJuice uses this client internally, and allocated time to open-source it for the good of error loggin' devs everywhere. If you are a broker, landlord or anyone who deals with residential real estate, consider checking them out as suitable "thanks" for using this plugin.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published