Code Monkey home page Code Monkey logo

exceptional-php's Introduction

Exceptional PHP

The power of Exceptional for PHP

Super simple setup

require "path/to/exceptional.php";
Exceptional::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 = "";
}

Exceptional::setup($api_key);

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

Exceptional::setup($api_key, true);

Filtering sensitive data

You can blacklist sensitive fields from being submitted to Exceptional:

Exceptional::setup($api_key);
Exceptional::blacklist(array('password', 'creditcardnumber'));

Exceptions and errors

Exceptional 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
);
Exceptional::context($context);

See the Exceptional documentation for more details.

Controller + action support

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

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

Proxy server

You can send exceptions through proxy server (no support for authentication).

Exceptional::proxy($host, $port);

exceptional-php's People

Contributors

ankane avatar jrbasso avatar lsimoneau avatar paulca avatar shime avatar till avatar zackkatz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.