1. Go to this page and download the library: Download k1low/faultline library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
k1low / faultline example snippets
// Create new Notifier instance.
$notifier = new Faultline\Notifier([
'project' => 'faultline-php',
'apiKey' => 'xxxxXXXXXxXxXXxxXXXXXXXxxxxXXXXXX',
'endpoint' => 'https://xxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/v0',
'timeout' => '30.0',
'notifications' => [
[
'type'=> 'slack',
'endpoint'=> 'https://hooks.slack.com/services/XXXXXXXXXX/B2RAD9423/WC2uTs3MyGldZvieAtAA7gQq',
'channel'=> '#random',
'username'=> 'faultline-notify',
'notifyInterval'=> 5,
'threshold'=> 10,
'timezone'=> 'Asia/Tokyo'
],
[
'type'=> 'github',
'userToken'=> 'XXXXXXXxxxxXXXXXXxxxxxXXXXXXXXXX',
'owner'=> 'k1LoW',
'repo'=> 'faultline',
'labels'=> [
'faultline', 'bug'
],
'if_exist'=> 'reopen-and-comment',
'notifyInterval'=> 1,
'threshold'=> 1,
'timezone'=> 'Asia/Tokyo'
]
]
]);
// 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 faultline-php');
} catch(Exception $e) {
Faultline\Instance::notify($e);
}