duncan3dc/exceptions

一个用于捕获异常并在最后统一抛出的小型库

1.2.0 2024-02-23 17:56 UTC

This package is auto-updated.

Last update: 2024-08-23 19:05:51 UTC


README

一个用于捕获异常并在稍后一起抛出的小型PHP库。

完整文档可在http://duncan3dc.github.io/exceptions/找到
PHPDoc API文档也可在http://duncan3dc.github.io/exceptions/api/找到

release build coverage

安装

推荐通过Composer安装此库。

从您的项目根目录运行以下命令

$ composer require duncan3dc/exceptions

用法

use duncan3dc\Exceptions\Catcher;

require __DIR__ . "/vendor/autoload.php";

$catcher = new Catcher;

$catcher->try(function () {
    throw new \Exception("Whoops1!");
});

$catcher->try(function () {
    throw new \Exception("Whoops2!");
});

$catcher->try(function () {
    echo "ok\n";
});

$catcher->throw();

更多信息请参阅http://duncan3dc.github.io/exceptions/

变更日志

从有史以来就有一个变更日志

如何获取帮助

发现了错误?有疑问?或者不确定某事物如何工作?
创建一个问题,我会尽力帮助。
或者您可以在Twitter上找到我

duncan3dc/exceptions 企业版

作为Tidelift订阅的一部分提供

duncan3dc/exceptions的维护者以及其他数千个软件包的维护者正在与Tidelift合作,为构建应用程序时使用的开源依赖项提供商业支持和维护。节省时间,降低风险,并提高代码质量,同时支付您使用的确切依赖项的维护者。了解更多。