bouiboui / tissue

Create Github issues from your code's Exceptions

Home Page:http://bouiboui.github.io/tissue

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tissue

Latest Version on Packagist License SensioLabsInsight

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.

Install

$ composer require bouiboui/tissue

Create a local config/config.yaml file from the template in config/config.yaml.dist

Usage

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:

Something like this Something like this

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.

Credits

License

Unlicense. Public domain, basically. Please treat it kindly. See License File for more information.

This project uses the following open source projects

About

Create Github issues from your code's Exceptions

http://bouiboui.github.io/tissue

License:The Unlicense


Languages

Language:PHP 100.0%