No items found.
January 14, 2013

Official BugSnag PHP Notifier Released

Today we are pleased to announce the release of the official BugSnag PHP Notifier. The BugSnag PHP Notifier gives you instant notification of exceptions thrown by your PHP apps.

PHP Logo

Automatic Error Handling

The BugSnag PHP Notifier comes with full support for automatic error and exception handling, since we provide handler functions that can be passed directly to PHP’s built-in [CODE]set_exception_handler[/CODE] and [CODE]set_error_handler[/CODE] functions.

-- CODE language-php --
// Initialize BugSnag with your API key

// Attach the automatic error handlers

See the BugSnag PHP Notifier docs for more information about the full capabilities of the notifier.

Manual Error Handling

For user-defined errors, you can also notify BugSnag manually using the [CODE]BugSnag::notifyError[/CODE] or [CODE]Bugsnag::notifyException[/CODE] functions.

-- CODE language-php --
// Notify BugSnag manually of an error
BugSnag::notifyError("PaymentFailedError", "The payment failed due to missing name");

// Notify BugSnag manually of an exception
BugSnag::notifyException(new Exception("Something bad happened"));

You can find more details about this and other functions in the BugSnag PHP Notifier docs.

Send Application-Specific Data With Errors

Bugsnag already collects and displays as much information as possible to help you debug your exceptions, including HTTP params, app environment and number of unique users affected, but as a developer you’ll know exactly which pieces of application data are most important to you.

To send custom data from your PHP apps, you can use [CODE]setMetaDataFunction[/CODE], for example:

-- CODE language-php --
// Tell BugSnag to use a metadata function

// Define the bugsnag metadata function
function bugsnag_metadata() {
   return array(
       "user" => array(
           "name"  => "Bob Hoskins",
           "email" => "",
           "role"  => "Super Mario"

Adding custom data will give you more insights into your exceptions, which should ultimately allow you to resolve them faster.


We’d also like to say a big thanks to Taylor Otwell for making his unofficial PHP notifier available before this release!

Learn more about BugSnag’s automatic PHP error reporting.

BugSnag helps you prioritize and fix software bugs while improving your application stability
Request a demo