PHPackages                             brenno-duarte/prettyexception - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. brenno-duarte/prettyexception

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

brenno-duarte/prettyexception
=============================

PrettyException is a component that helps to manipulate the Whoops component.

0.1.0(5y ago)15MITPHPPHP ^7.4|^8.0

Since Apr 18Pushed 5y ago1 watchersCompare

[ Source](https://github.com/brenno-duarte/prettyexception)[ Packagist](https://packagist.org/packages/brenno-duarte/prettyexception)[ RSS](/packages/brenno-duarte-prettyexception/feed)WikiDiscussions master Synced 2d ago

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

PHP PrettyException for Whoops
==============================

[](#php-prettyexception-for-whoops)

PrettyException is a component that helps to manipulate the Whoops component.

How to use
----------

[](#how-to-use)

```
use PrettyException\PrettyException;

$exception = new PrettyException();
```

You can return the error using:

- `inPretty`: returns with the Whoops screen
- `inJson`: returns the exception in JSON
- `inText`: returns the exception in text
- `inXml`: returns the exception in XML

Then use the `run` method.

```
$exception = new PrettyException();
$exception->inPretty()->run();
```

Customizing the exception screen
--------------------------------

[](#customizing-the-exception-screen)

It is possible to make some customizations on the exception screen.

`setTitle`: Sets the title for the error page.

```
$exception->setTitle('New Exception');
```

`table`: Adds a key=&gt;value table of arbitrary data, labeled by $label, to the output. Useful where you want to display contextual data along with the error, about your application or project.

```
$exception->table('New Exception', [
    'exc' => 'test',
    'exc2' => 10
]);
```

`tableCallback`: Similar to PrettyPageHandler::addDataTable, but accepts a callable that will be called only when rendering an exception. This allows you to gather additional data that may not be available very early in the process.

```
$exception->tableCallback('New Exception Callback', function(\Whoops\Exception\Inspector $inspector) {
    $data = array();
    $exception = $inspector->getException();
    if ($exception instanceof SomeSpecificException) {
        $data['Important exception data'] = $exception->getSomeSpecificData();
    }
    $data['Exception class'] = get_class($exception);
    $data['Exception code'] = $exception->getCode();
    return $data;
});
```

`closeTableAndRun`: Closes the table and executes the exception. Optionally, you can add a comment.

```
$exception->closeTableAndRun($comment);
```

Running exception in other formats
----------------------------------

[](#running-exception-in-other-formats)

In some cases like AJAX requests or using the command line, it is possible to display exceptions using `runIfAjax` and` runIfCli`.

`runIfAjax` will be executed if there are any AJAX requests and returned in JSON. Otherwise, the standard exception screen will be displayed.

`runIfCli` will only be run from the PHP command line.

```
$run->runIfAjax('Exception in AJAX');
$run->runIfCli('Exception in CLI');
```

License
-------

[](#license)

MIT

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

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

1852d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3b4643dd44cd0ca52917d341a3eb9ab4de7328ff2c2c2c227080c39f6a5606dc?d=identicon)[brenno-duarte](/maintainers/brenno-duarte)

---

Top Contributors

[![brenno-duarte](https://avatars.githubusercontent.com/u/32854266?v=4)](https://github.com/brenno-duarte "brenno-duarte (1 commits)")

---

Tags

phpphp-libraryphp7whoopswhoops-page

### Embed Badge

![Health badge](/badges/brenno-duarte-prettyexception/health.svg)

```
[![Health](https://phpackages.com/badges/brenno-duarte-prettyexception/health.svg)](https://phpackages.com/packages/brenno-duarte-prettyexception)
```

###  Alternatives

[yireo/magento2-whoops

Magento 2 module adding Whoops error handling

102703.5k](/packages/yireo-magento2-whoops)[snowair/phalcon-debugbar

Integrates PHP Debug Bar with Phalcon.

160123.3k1](/packages/snowair-phalcon-debugbar)[rarst/wps

WordPress plugin for whoops error handler.

129133.2k3](/packages/rarst-wps)[franzl/whoops-middleware

PSR-15 compatible middleware for Whoops, the pretty error handler

282.0M20](/packages/franzl-whoops-middleware)[clawrock/magento2-debug

Magento 2 debug module based on Magento 1 Profiler with some extra features.

8419.3k1](/packages/clawrock-magento2-debug)[dereuromark/cakephp-whoops

Whoops error handler for CakePHP

1492.4k1](/packages/dereuromark-cakephp-whoops)

PHPackages © 2026

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