PHPackages                             grifart/suppressed-exceptions - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. grifart/suppressed-exceptions

ActiveLibrary

grifart/suppressed-exceptions
=============================

Adds support for suppressed exceptions as known in Java. https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html#suppressed-exceptions

v0.2.2(4y ago)126.1k↓32%MITPHPPHP ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ^8.0

Since Nov 6Pushed 4y ago1 watchersCompare

[ Source](https://github.com/grifart/suppressed-exceptions)[ Packagist](https://packagist.org/packages/grifart/suppressed-exceptions)[ RSS](/packages/grifart-suppressed-exceptions/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (5)Used By (0)

Suppressed exceptions for PHP
=============================

[](#suppressed-exceptions-for-php)

Suppressed exceptions are useful for aggregating more exceptions from unreliable resources.

Useful when you want to communicate that process failed, with a list of sibling exceptions that led to an error.

repositories:

- [Grifart GitLab](https://gitlab.grifart.cz/grifart/suppressed-exceptions) [![pipeline status](https://camo.githubusercontent.com/370aaed29450ba4df9a9334d87368a2dbbe0a3344ce8a490cea26c1662aa2a68/68747470733a2f2f6769746c61622e677269666172742e637a2f677269666172742f737570707265737365642d657863657074696f6e732f6261646765732f6d61737465722f706970656c696e652e737667)](https://gitlab.grifart.cz/grifart/suppressed-exceptions/commits/master)
- [GitHub](https://github.com/grifart/suppressed-exceptions) (mirror) [![Build Status](https://camo.githubusercontent.com/c9e16089524bdd68141d1e5d33fea0736f95e4add7f2f310aa94ea6d4f560109/68747470733a2f2f7472617669732d63692e6f72672f677269666172742f737570707265737365642d657863657074696f6e732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/grifart/suppressed-exceptions)

Example usage
-------------

[](#example-usage)

```
$remoteSources = []; // classes representing unreliable remote sources

$exceptions = [];
foreach ($remoteSoures as $remoteSource) {
	try {
		$remoteSource->fetch(); // unsafe operation
	} catch (FetchingFailed $e) {
		$exceptions[] = $e;
		continue;
	}
}

if (count($exceptions) > 0) {
	$e = new ProcessingFailed();
	$e->addSuppressed(...$exceptions);
	throw $e;
}
```

You can also override exception constructor to provide better API

```
final class EventPropagationFailedException extends \RuntimeException implements \Grifart\SuppressedExceptions\WithSuppressedExceptions
{
	use \Grifart\SuppressedExceptions\SuppressedExceptions;

	public function __construct(\Throwable ...$suppressed)
	{
		parent::__construct('Saving succeeded, but some listeners failed to complete their job. Please check suppressed exceptions for more information.');
		$this->addSuppressed(...$suppressed);
	}
}
```

Usage is then

```
throw new EventPropagationFailedException(...$suppressedExceptions);
```

**TODO: screenshot from debugger** how it looks when catched

More reading
------------

[](#more-reading)

-

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~408 days

Total

4

Last Release

1523d ago

PHP version history (4 changes)v0.1.0PHP &gt;=7.1

v0.2.0PHP ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0

v0.2.1PHP ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0

v0.2.2PHP ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/939d12e9a77e30f843e33a785f81d8ee45b71bf2db88c0d32c0d36571c71a58d?d=identicon)[jkuchar](/maintainers/jkuchar)

---

Top Contributors

[![jkuchar](https://avatars.githubusercontent.com/u/133822?v=4)](https://github.com/jkuchar "jkuchar (26 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/grifart-suppressed-exceptions/health.svg)

```
[![Health](https://phpackages.com/badges/grifart-suppressed-exceptions/health.svg)](https://phpackages.com/packages/grifart-suppressed-exceptions)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
