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

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

kherge/exception
================

Simplifies the process of constructing new exceptions using formatted messages.

1.0.0(8y ago)0681Apache-2.0PHP

Since Feb 21Pushed 8y ago1 watchersCompare

[ Source](https://github.com/kherge/php.exception)[ Packagist](https://packagist.org/packages/kherge/exception)[ Docs](https://github.com/kherge/php.exception)[ RSS](/packages/kherge-exception/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/2e20f28472503b67ab44549017c8c0b864271916db00185243b59df1b7548676/68747470733a2f2f7472617669732d63692e6f72672f6b68657267652f7068702e657863657074696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kherge/php.exception)[![Quality Gate](https://camo.githubusercontent.com/ce69b35d2dd3e90f59bee0f02617e5ce85c69c2b46daee6576d6dad537a57479/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7068702e657863657074696f6e266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/dashboard?id=php.exception)

Exception
=========

[](#exception)

Simplifies the process of constructing new exceptions using formatted messages.

Usage
-----

[](#usage)

```
use KHerGe\Exception\AbstractException;

class MyException extends AbstractException
{
}

// Without any arguments.
$exception = new MyException();

// With only a message. ("Example message.")
$exception = new MyException('Example message.');

// With a message format and values to format. ("Example message.")
$exception = new MyException('Example %s.', 'message');

// With only a previous exception.
$exception = new MyException($previous);

// With a message and previous exception.
$exception = new MyException('Example message.', $previous);

// With a message format, values to format, and a previous exception.
$exception = new MyException('Example %s.', 'message', $previous);
```

Requirements
------------

[](#requirements)

- PHP 7.1 or greater

Installation
------------

[](#installation)

Use Composer to install the package as a dependency.

```
$ composer require kherge/exception

```

Testing
-------

[](#testing)

Use PHPUnit 7.0 to run the test suite.

```
$ phpunit

```

License
-------

[](#license)

This library is available under the Apache 2.0 and MIT licenses.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 95% 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

3052d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9122157?v=4)[Kevin Herrera](/maintainers/kherge)[@kherge](https://github.com/kherge)

---

Top Contributors

[![kherge](https://avatars.githubusercontent.com/u/9122157?v=4)](https://github.com/kherge "kherge (19 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

exceptionphpexceptionformatting

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[pear/pear_exception

The PEAR Exception base class.

9883.5M121](/packages/pear-pear-exception)[yireo/magento2-webp2

Magento 2 module to add WebP support to the Magento frontend

2111.3M7](/packages/yireo-magento2-webp2)[flarum/markdown

Allow posts to be formatted with Markdown.

18431.8k18](/packages/flarum-markdown)[flarum/emoji

Convert text and unicode emoji into Twemoji.

17404.2k4](/packages/flarum-emoji)[mnapoli/pretty

Run all code formatting tools with one command: pretty

1085.1k9](/packages/mnapoli-pretty)[phpattempt/phpattempt

Helper function to enforce error-first approach in your code

1713.6k](/packages/phpattempt-phpattempt)

PHPackages © 2026

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