PHPackages                             decodelabs/glitch - 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. decodelabs/glitch

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

decodelabs/glitch
=================

Better tools for when things go wrong

v0.22.0(7mo ago)722.0k↓100%13MITPHPPHP ^8.4CI passing

Since Aug 16Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/decodelabs/glitch)[ Packagist](https://packagist.org/packages/decodelabs/glitch)[ RSS](/packages/decodelabs-glitch/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (81)Used By (3)

Glitch
======

[](#glitch)

[![PHP from Packagist](https://camo.githubusercontent.com/d6c6851aedce5270912d79d2142366314530e55f080d84c520b1d4eb754cc8de/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6465636f64656c6162732f676c697463683f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/glitch)[![Latest Version](https://camo.githubusercontent.com/937eff09988aafda3ddb8886593f6aaf476aa1e1da63cb9f937a05b3e4559eb3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6465636f64656c6162732f676c697463682e7376673f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/glitch)[![Total Downloads](https://camo.githubusercontent.com/3636b844faf960e7ebca8754b4045f823dbc14e5314a5a44a56b4e42628594ad/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6465636f64656c6162732f676c697463682e7376673f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/glitch)[![GitHub Workflow Status](https://camo.githubusercontent.com/9d19d9297e04f97d680bb5ad18957bdffeec1235d992809af69bad15dc29d570/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6465636f64656c6162732f676c697463682f696e746567726174652e796d6c3f6272616e63683d646576656c6f70)](https://github.com/decodelabs/glitch/actions/workflows/integrate.yml)[![PHPStan](https://camo.githubusercontent.com/e25c14ce011edabdd0fbd2e10415b41cc5d66ed11ef3e5b7edd074c5bdd35a2d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d656e61626c65642d3434434331312e7376673f6c6f6e6743616368653d74727565267374796c653d666c6174)](https://github.com/phpstan/phpstan)[![License](https://camo.githubusercontent.com/489d6cf5d42c1ec1fb273997869bc120c1644471e89d6b47ca8cb044037d3e64/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6465636f64656c6162732f676c697463683f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/glitch)

### Better tools for when things go wrong

[](#better-tools-for-when-things-go-wrong)

Glitch is a standalone PHP package designed to dramatically improve error handling and inspection when developing your applications.

The project aims to provide deep data inspection tools and an Exception handling interface.

---

[![v0.19 interface](docs/v0.19.png)](docs/v0.19.png)

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

[](#installation)

This package requires PHP 8.4 or higher.

Install via Composer:

```
composer require decodelabs/glitch
```

Usage
-----

[](#usage)

```
use DecodeLabs\Glitch;
use DecodeLabs\Monarch;

$glitch = Monarch::getService(Glitch::class);
$glitch->dump('hello');
```

### Setup

[](#setup)

Otherwise, Glitch works out of the box without any special setup. There are however some optional steps you can take to customise operation.

Register as the default error handler:

```
$glitch->registerAsErrorHandler();
```

Pass the `microtime()` of initial app launch for timing purposes:

```
$glitch->setStartTime(microtime(true));
```

Dumps
-----

[](#dumps)

Dump anything and everything easily, using simple global functions. The functions mirror those used in Symfony/VarDumper, maintaining compatibility by using Symfony's VarDumper interface if it is already loaded.

```
class MyThing {}
$myObject = new MyThing();

// This will dump the object and carry on
dump($myObject);

// This will dump the object and exit
dd($myObject);
```

#### Renderers

[](#renderers)

The resulting dump UI (when using the HTML renderer, the default option) is injected into an iframe at runtime so can be rendered into any HTML page without breaking anything. If the page is otherwise empty, the iframe will expand to fill the viewport if possible.

The dump output is rendered by an instance of `DecodeLabs\Glitch\Renderer` which can be overridden on the default Service at startup. The `Html` renderer is loaded under http sapi, the `Cli` renderer is used when under the CLI sapi.

Custom renderers may convert `Entities` to other output formats depending on where they should be sent, such as Xml or Json for example. The Renderer system uses [Nuance](https://github.com/decodelabs/nuance) to inspect and render the data, please see that project for more information on how to create custom renderers.

#### Custom colours

[](#custom-colours)

The HTML renderer uses css variables to style individual element colours and can be overridden with custom values. Create a custom css file with variable overrides:

```
:root {
    --string: purple;
    --binary: green;
}
```

See [colours.scss](./zest/src/sass/global/_colors.scss) for all of the current colour override options.

Then load the file into the HTML renderer:

```
$glitch->getRenderer()->setCustomCssFile('path/to/my/file.css');
```

#### Transports

[](#transports)

Once rendered, the dump information is delivered via an instance of `DecodeLabs\Glitch\Transport`, also overridable on the default Service. It is the responsibility of the `Transport` to deliver the rendered dump.

By default, the render is just echoed out to `STDOUT`, however custom transports may send information to other interfaces, browser extensions, logging systems, etc.

### Custom dumps

[](#custom-dumps)

You can customise how your own class instances are dumped by implementing `DecodeLabs\Nuance\Dumpable` interface.

Please see the [Nuance documentation](https://github.com/decodelabs/nuance?tab=readme-ov-file#custom-dumps) for more information on how to do this.

Licensing
---------

[](#licensing)

Glitch is licensed under the MIT License. See [LICENSE](./LICENSE) for the full license text.

###  Health Score

56

—

FairBetter than 97% of packages

Maintenance82

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 99.8% 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 ~28 days

Total

79

Last Release

217d ago

PHP version history (6 changes)v0.5.0PHP ^7.1.3

v0.6.0PHP ^7.2

v0.17.0PHP ^7.2|^8.0

v0.18.0PHP ^8.0

v0.18.10PHP ^8.1

v0.19.0PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a241d64d12b3b5ee94197862ec1ec30b82ed2efa34a0cd7f4c3565a021daddd?d=identicon)[betterthanclay](/maintainers/betterthanclay)

---

Top Contributors

[![betterthanclay](https://avatars.githubusercontent.com/u/1273586?v=4)](https://github.com/betterthanclay "betterthanclay (650 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (1 commits)")

---

Tags

debugdeveloper-toolsdumperexceptionsphpdebugdumpexceptiondumper

### Embed Badge

![Health badge](/badges/decodelabs-glitch/health.svg)

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

###  Alternatives

[symfony/var-dumper

Provides mechanisms for walking through any arbitrary PHP variable

7.4k855.5M7.9k](/packages/symfony-var-dumper)[php-debugbar/php-debugbar

Debug bar in the browser for php application

4.4k21.3M38](/packages/php-debugbar-php-debugbar)[kint-php/kint

Kint - Advanced PHP dumper

2.8k19.3M281](/packages/kint-php-kint)[jbzoo/jbdump

Script for debug and dump PHP variables and other stuff. This tool is a nice replacement for print\_r() and var\_dump() functions.

211.1M3](/packages/jbzoo-jbdump)[php-sage/sage

☯ Insightful PHP debugging assistant.

5639.7k5](/packages/php-sage-sage)[ivoba/stop

nice output for debug functions for PHP 5.3

1041.9k5](/packages/ivoba-stop)

PHPackages © 2026

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