PHPackages                             pioniro/contextable-exception - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. pioniro/contextable-exception

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pioniro/contextable-exception
=============================

Adds context to your exceptions

v1.0(6y ago)03.0k1MITPHP

Since Apr 1Pushed 6y ago1 watchersCompare

[ Source](https://github.com/pioniro/ContextableException)[ Packagist](https://packagist.org/packages/pioniro/contextable-exception)[ RSS](/packages/pioniro-contextable-exception/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (1)

Contextable exception
=====================

[](#contextable-exception)

Is a common interfaces for adding a context in your exceptions.

It may be useful for providing more context data in logger (or sentry, etc) more context data

*before:*

```
function badFunction($id)
{
    throw new \Exception(sprintf('bad Id: %d', $id));
}
```

*after:*

```
use Pioniro\ContextableException\ContextableInterface;
use Pioniro\ContextableException\ContextableTrait;

class MyException extends \Exception implements ContextableInterface {
    use ContextableTrait;
}

function badFunction($id)
{
    throw (new MyException('bad Id'))->addContext(['id' => $id]);
}
```

OR

```
use Pioniro\ContextableException\ContextableInterface;

function badSuperFunction($id, $name)
{
    try {
        badThirdPartyFunction($id);
    } catch (ContextableInterface $e) {
        $e->addContext(['name' => $name]);
        throw $e;
    }
}
```

Did you see this? We provide more data for exception

That's why this library is.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

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

Unknown

Total

1

Last Release

2238d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/eca01fca0e1db51e514c7a5b3e0d17ae48cbf26fa67df8ee8927ca921cec2d9d?d=identicon)[Pioniro](/maintainers/Pioniro)

---

Top Contributors

[![pioniro](https://avatars.githubusercontent.com/u/6437567?v=4)](https://github.com/pioniro "pioniro (1 commits)")

### Embed Badge

![Health badge](/badges/pioniro-contextable-exception/health.svg)

```
[![Health](https://phpackages.com/badges/pioniro-contextable-exception/health.svg)](https://phpackages.com/packages/pioniro-contextable-exception)
```

PHPackages © 2026

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