PHPackages                             stanbridge/visual-exceptions - 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. stanbridge/visual-exceptions

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

stanbridge/visual-exceptions
============================

Visual Laravel exceptions delivered via iframe for single page applications

0.0.5(1y ago)619.7k↓55.9%MITPHPPHP ^7.4|^8.0

Since Jul 26Pushed 1y ago3 watchersCompare

[ Source](https://github.com/stanbridge/visual-exceptions)[ Packagist](https://packagist.org/packages/stanbridge/visual-exceptions)[ Docs](https://github.com/Stanbridge/visual-exceptions)[ RSS](/packages/stanbridge-visual-exceptions/feed)WikiDiscussions master Synced 2d ago

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

[![logo](https://camo.githubusercontent.com/f77cb5d7a57444c7c1a59131ad28e645843e047d4a166617185317244ed1aadc/68747470733a2f2f63646e2e7374616e6272696467652e6564752f676c6f62616c2f696d672f6c6f676f2d2d646f63756d656e746174696f6e2e706e67)](https://camo.githubusercontent.com/f77cb5d7a57444c7c1a59131ad28e645843e047d4a166617185317244ed1aadc/68747470733a2f2f63646e2e7374616e6272696467652e6564752f676c6f62616c2f696d672f6c6f676f2d2d646f63756d656e746174696f6e2e706e67)

---

Visual Laravel Exceptions for SPAs
==================================

[](#visual-laravel-exceptions-for-spas)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6d6fabbe686742b0f92c373d9c0d1759122cb2297c0ae6a5f57ed5ae67f86364/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7374616e6272696467652f76697375616c2d657863657074696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stanbridge/visual-exceptions)[![Tests](https://github.com/stanbridge/visual-exceptions/workflows/Tests/badge.svg)](https://github.com/stanbridge/visual-exceptions/workflows/Tests/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/d0843195ff986d4ec0f8e38d354a438183e1c090e1b5030244070808afacc0da/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7374616e6272696467652f76697375616c2d657863657074696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stanbridge/visual-exceptions)

This package provides single page applications with a visual representation of exceptions similar to traditional Laravel applications. This is accomplished by temporarily storing the output of the rendered exception in a file. When the client receives an error, you can use the included `render-exception.js` service to open up an iframe to display the rendered exception in the browser.

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

[](#installation)

You can install the package via composer:

```
composer require stanbridge/visual-exceptions
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Stanbridge\VisualException\VisualExceptionServiceProvider" --tag="config"
```

This is the contents of the published config file:

```
return [

    /*
    |--------------------------------------------------------------------------
    | Master Switch
    |--------------------------------------------------------------------------
    |
    | This option may be used to completely disable visual exceptions.
    |
    */

    'enabled' => env('VISUAL_EXCEPTIONS_ENABLED', env('APP_DEBUG')),

    /*
    |--------------------------------------------------------------------------
    | Path
    |--------------------------------------------------------------------------
    |
    | This is the URI path where visual exceptions will be accessible from.
    |
    */

    'path' => env('VISUAL_EXCEPTIONS_PATH', 'api/visual-exceptions'),

    /*
    |--------------------------------------------------------------------------
    | Storage
    |--------------------------------------------------------------------------
    |
    | This is where the temporary exception output will be stored.
    |
    */

    'storage' => 'visual-exceptions/latest.html',

    /*
    |--------------------------------------------------------------------------
    | Clear on Retrieve
    |--------------------------------------------------------------------------
    |
    | Use this option to clear the exception file after retrieving it.
    |
    */

    'clear_on_retrieve' => env('VISUAL_EXCEPTIONS_CLEAR', true),

    /*
    |--------------------------------------------------------------------------
    | Middleware
    |--------------------------------------------------------------------------
    |
    | Set middleware on the route.
    |
    */

    'middleware' => ['api'],
];
```

Usage
-----

[](#usage)

### 1. Capture the Exception

[](#1-capture-the-exception)

In your `app/Exceptions/Handler.php`, capture the rendered exception with the following:

```
use \Illuminate\Support\Facades\Config;
use Stanbridge\VisualException\VisualException;

public function render($request, Throwable $exception)
{
    $render = $this->prepareResponse($request, $exception);

    if (Config::get('visual-exceptions.enabled')) {
        VisualException::capture($render);
    }

    return $render;
}
```

### 2. Publish the assets:

[](#2-publish-the-assets)

`php artisan vendor:publish --provider="Stanbridge\VisualException\VisualExceptionServiceProvider" --tag=assets`

### 3. Display the Exception

[](#3-display-the-exception)

Copy the `render-exception.js` file from the published assets into your single page application.

Import the library and use the `retrieveLastError()` method. Here is an example using an axios interceptor:

```
import axios from 'axios';
import VisualException from 'path/to/render-exception.js';

axios.interceptors.response.use(response => response, error => {
    if (error.response.status >= 500) {
        VisualException.retrieveLastError();
    }
});
```

The code in `render-exception.js` comes from [Livewire](https://github.com/livewire/livewire). Thanks to [Caleb Porzio](https://github.com/calebporzio) and [Jonathan Reinink](https://github.com/reinink)

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Austin White](https://github.com/AustinW)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

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

Every ~412 days

Total

5

Last Release

520d ago

PHP version history (2 changes)0.0.1PHP ^7.4

0.0.3PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9444ae0906d85682c4700758c9ac0b7903e693557da4b6a876c11eff026bbcdc?d=identicon)[AustinW](/maintainers/AustinW)

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

---

Top Contributors

[![AustinW](https://avatars.githubusercontent.com/u/333398?v=4)](https://github.com/AustinW "AustinW (23 commits)")

---

Tags

visual-exceptions

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/stanbridge-visual-exceptions/health.svg)

```
[![Health](https://phpackages.com/badges/stanbridge-visual-exceptions/health.svg)](https://phpackages.com/packages/stanbridge-visual-exceptions)
```

PHPackages © 2026

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