faultline exception and error notifier for PHP.
PHP
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
tests
.editorconfig
.gitignore
.travis.yml
README.md
composer.json
phpunit.xml.dist

README.md

faultline-php Travis

faultline exception and error notifier for PHP.

Installation

$ composer require k1low/faultline

Usage

// Create new Notifier instance.
$notifier = new Faultline\Notifier([
    'project' => 'faultline-test',
    'apiKey' => 'xxxxXXXXXxXxXXxxXXXXXXXxxxxXXXXXX',
    'endpoint' => 'https://xxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/v0',
    'notifications' => [
        [
            'type'=> 'slack',
            'endpoint'=> 'https://hooks.slack.com/services/XXXXXXXXXX/B2RAD9423/WC2uTs3MyGldZvieAtAA7gQq',
            'channel'=> '#random',
            'username'=> 'faultline-notify',
            'notifyInterval'=> 5,
            'threshold'=> 10
        ],
        [
            'type'=> 'github',
            'userToken'=> 'XXXXXXXxxxxXXXXXXxxxxxXXXXXXXXXX',
            'owner'=> 'k1LoW',
            'repo'=> 'faultline',
            'threshold'=> -1
        ]
    ]
]);

// Set global notifier instance.
Faultline\Instance::set($notifier);

// Register error and exception handlers.
$handler = new Faultline\ErrorHandler($notifier);
$handler->register();

// Somewhere in the app...
try {
    throw new Exception('hello from phpbrake');
} catch(Exception $e) {
    Faultline\Instance::notify($e);
}

References

License

MIT © Ken'ichiro Oyama