duncan3dc/exceptions

A small library to catch exceptions and throw them all at the end

1.2.0 2024-02-23 17:56 UTC

This package is auto-updated.

Last update: 2024-11-23 19:50:51 UTC


README

A small PHP library to catch exceptions and throw them all together later.

Full documentation is available at http://duncan3dc.github.io/exceptions/
PHPDoc API documentation is also available at http://duncan3dc.github.io/exceptions/api/

release build coverage

Installation

The recommended method of installing this library is via Composer.

Run the following command from your project root:

$ composer require duncan3dc/exceptions

Usage

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();

Read more at http://duncan3dc.github.io/exceptions/

Changelog

A Changelog has been available since the beginning of time

Where to get help

Found a bug? Got a question? Just not sure how something works?
Please create an issue and I'll do my best to help out.
Alternatively you can catch me on Twitter

duncan3dc/exceptions for enterprise

Available as part of the Tidelift Subscription

The maintainers of duncan3dc/exceptions and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.