PHPackages                             wernerdweight/enhanced-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. wernerdweight/enhanced-exception

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

wernerdweight/enhanced-exception
================================

Generic enhanced exception to be used in other projects

2.0.0(3y ago)17.6k4MITPHPPHP &gt;=8.1

Since Jun 1Pushed 3y ago1 watchersCompare

[ Source](https://github.com/wernerdweight/EnhancedException)[ Packagist](https://packagist.org/packages/wernerdweight/enhanced-exception)[ Docs](https://github.com/wernerdweight/EnhancedException)[ RSS](/packages/wernerdweight-enhanced-exception/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (5)Used By (4)

EnhancedException
=================

[](#enhancedexception)

Generic enhanced exception to be used in other projects

[![Build Status](https://camo.githubusercontent.com/47f33d7ac6f3602835d74354a66dceab5e378decc99f4914d6d2a9ccf018beae/68747470733a2f2f6170702e7472617669732d63692e636f6d2f7765726e6572647765696768742f456e68616e636564457863657074696f6e2e7376673f6272616e63683d6d6173746572)](https://app.travis-ci.com/wernerdweight/EnhancedException)[![Latest Stable Version](https://camo.githubusercontent.com/0e8a1c28e5b4d73dd0ee610138a8dea4c5dc6190b14190c558ca736e1bf987cb/68747470733a2f2f706f7365722e707567782e6f72672f7765726e6572647765696768742f656e68616e6365642d657863657074696f6e2f762f737461626c65)](https://packagist.org/packages/wernerdweight/enhanced-exception)[![Total Downloads](https://camo.githubusercontent.com/debe6fac98b3046c0eb05e6d68f95119a2c8d005bcec3a59a45985ca980ffce5/68747470733a2f2f706f7365722e707567782e6f72672f7765726e6572647765696768742f656e68616e6365642d657863657074696f6e2f646f776e6c6f616473)](https://packagist.org/packages/wernerdweight/enhanced-exception)[![License](https://camo.githubusercontent.com/2e390f015a32ed7bde8b5589fe36a1c7bd5f925f03a7dbcc2d96e37e44b53675/68747470733a2f2f706f7365722e707567782e6f72672f7765726e6572647765696768742f656e68616e6365642d657863657074696f6e2f6c6963656e7365)](https://packagist.org/packages/wernerdweight/enhanced-exception)

Instalation
-----------

[](#instalation)

1. Download using composer

```
composer require wernerdweight/enhanced-exception
```

2. Define your exceptions

```
use WernerDweight\EnhancedException\Exception\AbstractEnhancedException;

class MyException extends AbstractEnhancedException
{
    /** @var int */
    public const EXCEPTION_SOMETHING_BAG_HAPPENED = 1;
    /** @var int */
    public const EXCEPTION_DIDNT_EXPECT_SPANISH_INQUISITION = 2;

    /** @var string[] */
    protected static $messages = [
        self::EXCEPTION_SOMETHING_BAG_HAPPENED => 'Something bad happened! Helpful, I know.',
        self::EXCEPTION_DIDNT_EXPECT_SPANISH_INQUISITION => 'Didn\'t expect Spanish inquisition to reach user %s!',
    ];
}
```

3. Use your exceptions

```
throw new MyException(MyException::EXCEPTION_DIDNT_EXPECT_SPANISH_INQUISITION, [$user->getUsername()]);
// will throw `Didn't expect Spanish inquisition to reach user Ferdinand II!`
```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity71

Established project with proven stability

 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 ~453 days

Total

4

Last Release

1182d ago

Major Versions

1.1.1 → 2.0.02023-02-21

PHP version history (2 changes)1.0.0PHP &gt;=7.2.0

2.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b1454d4a92d76c33018ef518335ec921cf3eadbe591437c47622510f465c9ed?d=identicon)[wernerdweight](/maintainers/wernerdweight)

---

Top Contributors

[![wernerdweight](https://avatars.githubusercontent.com/u/2445436?v=4)](https://github.com/wernerdweight "wernerdweight (5 commits)")

---

Tags

exceptiongenericEnhanced

### Embed Badge

![Health badge](/badges/wernerdweight-enhanced-exception/health.svg)

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

###  Alternatives

[pear/pear_exception

The PEAR Exception base class.

9880.2M101](/packages/pear-pear-exception)[yireo/magento2-webp2

Magento 2 module to add WebP support to the Magento frontend

2091.2M7](/packages/yireo-magento2-webp2)[nikolaposa/cascader

Utility for creating objects in PHP from constructor parameters definitions.

12237.5k3](/packages/nikolaposa-cascader)[phpattempt/phpattempt

Helper function to enforce error-first approach in your code

1710.4k](/packages/phpattempt-phpattempt)

PHPackages © 2026

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