bouiboui/tissue

此软件包已被废弃且不再维护。没有建议的替代软件包。

从您的异常中创建Github问题

v0.0.3 2016-02-23 13:03 UTC

This package is not auto-updated.

Last update: 2022-04-16 05:18:53 UTC


README

Latest Version on Packagist License SensioLabsInsight

从您的 catch {} 块中创建Github问题。我深受 ohCrash 的启发。

当您调用 Tissue::create 时,将在您选择的仓库中创建一个Github问题,并自动应用“bug”标签。在一定程度上可以检测到重复项。

名字来源于“Throw ISSUE”——我知道这很聪明。

安装

$ composer require bouiboui/tissue

config/config.yaml.dist 中的模板创建一个本地的 config/config.yaml 文件

使用方法

简单方法: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();

针对捕获块的方法: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);

}

自定义输出方法: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);

}

创建以下问题

Something like this Something like this

并输出以下内容

array(3) {
  ["duplicate"]=>
  bool(false)
  ["number"]=>
  int(35)
  ["url"]=>
  string(50) "https://api.github.com/repos/author/name/issues/35"
}

出于安全考虑,如果您的Github仓库是公开的,您至少应该禁用 trace 参数,除非您希望互联网上的陌生人知道您的服务器上文件的完整路径。 您可能还想阅读这个

鸣谢

许可证

Unlicense。基本上属于公共领域。请友好对待。有关更多信息,请参阅 许可证文件

此项目使用以下开源项目