PHPackages                             php-enspired/exceptable - 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. php-enspired/exceptable

ActiveLibrary

php-enspired/exceptable
=======================

Augmented features for exceptions and exception handling.

v6.0(9mo ago)31.2k2MPL-2.0PHP ^8.3

Since Dec 17Pushed 9mo agoCompare

[ Source](https://github.com/php-enspired/exceptable)[ Packagist](https://packagist.org/packages/php-enspired/exceptable)[ Docs](https://php.enspi.red)[ RSS](/packages/php-enspired-exceptable/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (4)Versions (15)Used By (2)

[![](https://camo.githubusercontent.com/745206438ac8992f3ac747e922b3c0f1af286b88fed9da8c5a8090f8d653f512/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7068702d656e7370697265642f65786365707461626c652e737667)](https://camo.githubusercontent.com/745206438ac8992f3ac747e922b3c0f1af286b88fed9da8c5a8090f8d653f512/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7068702d656e7370697265642f65786365707461626c652e737667) [![](https://camo.githubusercontent.com/b63a5fc65903e6c0c39c065b10efc3a6a1c08555aad6be1d63e2ee5b0c71a2b4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332d626c75652e7376673f636f6c6f72423d383839324246)](https://camo.githubusercontent.com/b63a5fc65903e6c0c39c065b10efc3a6a1c08555aad6be1d63e2ee5b0c71a2b4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332d626c75652e7376673f636f6c6f72423d383839324246) [![](https://camo.githubusercontent.com/35bcbe44160d7e0a3efe93a55f55071e05da59638fa735808c6d32764cf14e63/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d504c2e322e302d6f72616e67652e737667)](https://camo.githubusercontent.com/35bcbe44160d7e0a3efe93a55f55071e05da59638fa735808c6d32764cf14e63/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d504c2e322e302d6f72616e67652e737667)

how exceptable!
===============

[](#how-exceptable)

A lot of php code treats exceptions in an ad-hoc way: throwing a plain `Exception` instance with a message written inline. Then, when (...if?) you look at your error log, you have to start working backwards to figure out the state of the application at that time. This can be frustrating and painful.

*Exceptables* make exceptions exceptional. Exceptables:

- ✓ are easy to create and pass details to
- ✓ are readable by both humans and your application code
- ✓ can provide a wealth of runtime information about the state of things that led to the problem
- ✓ make it easy to add, adapt, and maintain error handling code as your application grows

More importantly, when throwing an Exceptable, you can include any additional information that might be helpful - values of arguments or local variables, details about state, whole objects, anything! This *context* is good for adding details to the error message, but can also be sent to log aggregation tools, and even be used at runtime to inspect the error and recover or fail gracefully.

dependencies
------------

[](#dependencies)

Requires php 8.3 or later.

ICU support requires the `intl` extension.

installation
------------

[](#installation)

Recommended installation method is via [Composer](https://getcomposer.org/):

simply `composer require "php-enspired/exceptable:^6"`

a quick taste
-------------

[](#a-quick-taste)

```
