Create Github issues from your catch {}
blocks. I was heavily inspired by ohCrash.
When you call Tissue::create
, a Github issue is created in the repo of your choice and a "bug" label is automatically applied. Duplicates are detected, to a certain extent.
The name comes from "Throw ISSUE" — genius, I know.
$ composer require bouiboui/tissue
Create a local config/config.yaml
file from the template in config/config.yaml.dist
The easy way: bindUncaughtExceptionHandler
// Not shown: include composer's autoload.php
use bouiboui\Tissue\Tissue;
// All uncaught exceptions will trigger the creation of a Github issue
Tissue::bindUncaughtExceptionHandler();
The catch-block-specific way: createFromException
// Not shown: include composer's autoload.php
use bouiboui\Tissue\Tissue;
try {
throw new ErrorException('This is your issue title and message.');
} catch (\ErrorException $e) {
// Only exceptions caught by this block will create Github issues
$result = Tissue::createFromException($e);
}
The "customized output" way: create
// Not shown: include composer's autoload.php
use bouiboui\Tissue\Tissue;
try {
throw new ErrorException('This is your issue title and message.');
} catch (\ErrorException $e) {
// Set any parameter to null if you don't want to display it in the issue
$result = Tissue::create(
$e->getMessage(),
$e->getCode(),
$e->getSeverity(),
$e->getFile(),
$e->getLine(),
$e->getTraceAsString()
);
var_dump($result);
}
Creates the following issue:
And outputs the following:
array(3) {
["duplicate"]=>
bool(false)
["number"]=>
int(35)
["url"]=>
string(50) "https://api.github.com/repos/author/name/issues/35"
}
For security purposes, if your Github repository is public you should at the very least disable the trace
parameter, unless you want strangers on the Internet to know the full path to the files on your server. You may also want to read this.
- bouiboui — Github Twitter Website
- All contributors
Unlicense. Public domain, basically. Please treat it kindly. See License File for more information.
This project uses the following open source projects