Skip to content

andyhot/bugsense-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bugsense PHP

Bugsense for PHP

Super simple setup

require "path/to/bugsense.php";
Bugsense::setup("YOUR-API-KEY");

You can turn off exception notifications by passing an empty string as the API key. This is great for development.

if (PHP_ENV == "production") {
  $api_key = "YOUR-API-KEY";
}
else {
  $api_key = "";
}

Bugsense::setup($api_key);

You can turn on SSL by setting the second parameter to true.

Bugsense::setup($api_key, true);

Exceptions and errors

Bugsense PHP catches both errors and exceptions. You can control which errors are caught. If you want to ignore certain errors, use error_reporting(). Here's a common setting:

error_reporting(E_ALL & ~E_NOTICE);  // ignore notices

Custom error and exception handlers are supported - see examples/advanced.php.

Fatal and parse errors are caught, too - as long the setup file parses correctly.

404 support

Add the following code to your 404 handler to track 404 errors:

throw new Http404Error();

Send extra data with your exceptions

$context = array(
    "user_id" => 1
);
Bugsense::context($context);

Controller + action support

You can include the controller and action names in your exceptions for easier debugging.

Bugsense::$controller = "welcome";
Bugsense::$action = "index";

Misc notes

Based on http://github.com/ankane/exceptional-php - some of the features above may not apply for bugsense (expect an update of the docs in the following days)

About

Integrate bugsense.com with php

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages