Skip to content

gevans/kohana-airbrake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Airbrake for Kohana

Airbrake collects errors generated by other applications, and aggregates the results for review.

Airbrake Screenshot

Overview

This module provides drop-in exception handling for Kohana. Any uncaught exceptions encountered will be POSTed to the Airbrake server specified in your environment along with relevant data ($_SERVER, request params, backtrace, etc.).

Installation

You can install this module by either cloning:

git clone git://github.com/gevans/kohana-airbrake modules/airbrake

Adding as a submodule:

git submodule add git://github.com/gevans/kohana-airbrake modules/airbrake

Or, downloading an archive of the repository.

After that, you can enable Airbrake in your application's bootstrap.php by adding the following line to your modules definition:

<?php
Kohana::modules(array(
    'airbrake' => MODPATH.'airbrake', // Airbrake exception handling and notifications
    // ...
));

Configuration

  • Register an account at Airbrake (A rate-limited, single project plan is available for free).

  • Create a new project in the Airbrake account manager.

  • View your project, and make note of the API key.

  • Copy modules/airbrake/config/airbrake.php to your application's config directory.

  • Update the configuration file with your API key and make tweaks, if needed.

  • Enjoy super-awesome-ultra-efficient notifications and exception handling.

Usage

For the most part, Airbrake works for itself. Any uncaught exceptions will automatically be sent to the Airbrake server. You can, however, trigger notifications manually using Airbrake::notify().

Filtering

Keeping your users' data secure is important. You can specify which form fields you wish to have removed from reports by adding fields to the params_filters array in the configuration. Before sending a report, the parameters will be filtered, so:

<?php
array('password' => 'super secret!');

Becomes:

<?php
array('password' => '[FILTERED]');

Experimental Javascript Support

Airbrake has the ability to catch Javascript errors that occur in browsers viewing HTML pages from your web application.

You can enable the JS notifier in your page layout, within the head section:

<html>
  <head>
    <!-- ... -->
    <?= Airbrake::javascript_notifier() ?>
    <!-- ... -->

This will insert a snippet of code to load the Airbrake Javascript notifier and set your API key and other settings to begin logging your uncaught exceptions. You can find more information in the knowledge base entry for the Javascript Notifier.

More Information

The module's classes are well documented and should satisfy you for most of your hacking. Unfortunately, there are no unit tests at this time, though I will reward you with many Internet points for making a pull request with improvements.

The Airbrake knowledge base has a large amount of information.

Contributing

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the version or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Acknowledgments

This module is a shameless rip-off/translation of the official Ruby gem. A few snippets are borrowed from @ahutchings's kohana-hoptoad module as well.

Copyright

Copyright (c) 2012 Gabriel Evans. See LICENSE.txt for further details (MIT licensed).

About

Exception handling and error notifications through Airbrake.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages