PHPackages                             eloquent/depict - 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. eloquent/depict

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

eloquent/depict
===============

A fast, recursion-safe, and succinct replacement for var\_dump/var\_export/print\_r.

0.1.0(9y ago)2125↓100%MITPHPPHP &gt;=5.3

Since Jan 10Pushed 2y ago1 watchersCompare

[ Source](https://github.com/eloquent/depict)[ Packagist](https://packagist.org/packages/eloquent/depict)[ Docs](https://github.com/eloquent/depict)[ RSS](/packages/eloquent-depict/feed)WikiDiscussions master Synced 2mo ago

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

> # No longer maintained
>
> [](#no-longer-maintained)
>
> This package is no longer maintained. See [this statement](https://gist.github.com/ezzatron/713a548735febe3d76f8ca831bc895c0) for more info.

Depict
======

[](#depict)

*A fast, recursion-safe, and succinct replacement for var\_dump/var\_export/print\_r.*

[![Current version image](https://camo.githubusercontent.com/823baaf9024261e861d197c1eae2a0522c38e9ee55947a02e5338ad14fd257cb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c6f7175656e742f6465706963742e7376673f7374796c653d666c61742d737175617265 "This project uses semantic versioning")](https://packagist.org/packages/eloquent/depict)[![Current build status image](https://camo.githubusercontent.com/7b66092873d5ef49dc3ce0b647bb4157f3c3e5523b809c3c1de0a2e3c8968e2d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f656c6f7175656e742f6465706963742f6d61737465722e7376673f7374796c653d666c61742d737175617265 "Current build status for the master branch")](https://travis-ci.org/eloquent/depict)[![Current Windows build status image](https://camo.githubusercontent.com/919a99b7a7d4ae241a0f3c12bd8975e6aebcd81b06991b31b33126c93a0d88a0/68747470733a2f2f696d672e736869656c64732e696f2f6170707665796f722f63692f656c6f7175656e742f6465706963742f6d61737465722e7376673f6c6162656c3d77696e646f7773267374796c653d666c61742d737175617265 "Current Windows build status for the master branch")](https://ci.appveyor.com/project/eloquent/depict)[![Tested against HHVM](https://camo.githubusercontent.com/fbdbbc8395ac503d224ccacf0e3a588e948b146ff4f9070f0d9adba8df926b01/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6868766d2d7465737465642d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265 "Tested against HHVM")](https://travis-ci.org/eloquent/depict)[![Current coverage status image](https://camo.githubusercontent.com/306b16cc2f71860063d9742ecf7d957261c65976a76defac39d04254c170e3f2/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f656c6f7175656e742f6465706963742f6d61737465722e7376673f7374796c653d666c61742d737175617265 "Current test coverage for the master branch")](https://codecov.io/github/eloquent/depict)

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

[](#installation)

- Available as [Composer](http://getcomposer.org/) package [eloquent/depict](https://packagist.org/packages/eloquent/depict).

Usage
-----

[](#usage)

```
use Eloquent\Depict\InlineExporter;

$exporter = InlineExporter::create();
echo $exporter->export(['a', 'b', 'c', 1, 2, 3]); // outputs '#0["a", "b", "c", 1, 2, 3]'
```

What is *Depict*?
-----------------

[](#what-is-depict)

*Depict* is a `var_dump()`/`var_export()`/`print_r()` replacement that focuses on performance, succinctness, and recursion safety. In contrast to many of the available libraries providing similar functionality, *Depict* is designed specifically for command line output (not HTML).

*Depict* is based on the [exporter used by Phony](http://eloquent-software.com/phony/latest/#the-exporter), and is essentially the same code, with the Phony-specific parts removed.

Exporters
---------

[](#exporters)

*Depict* currently implements only one exporter, the [`InlineExporter`](#inlineexporter). More exporters may be implemented in future. Exporters implement a very simple [`Exporter`](src/Exporter.php) interface.

### `InlineExporter`

[](#inlineexporter)

This exporter is designed for single-line output of values. To create an inline exporter, use `InlineExporter::create()`:

```
$exporter = InlineExporter::create();
```

`InlineExporter::create()` can also accept an options array to customize its output:

```
$exporter = InlineExporter::create(['depth' => 1]);
```

Available options for `InlineExporter::create()`:

OptionDescriptionDefault`depth`An integer that determines the depth to which Depict will export before truncating output. Negative values are treated as infinite depth.`-1``breadth`An integer that determines the number of sub-values that Depict will export before truncating output. Negative values are treated as infinite breadth.`-1``useShortNames`When `true`, Depict will omit namespace information from exported symbol names.`true``useShortPaths`When `true`, Depict will export only the basename of closure paths.`false`The export format
-----------------

[](#the-export-format)

Depict generates a concise, unambiguous, human-readable representation of any PHP value, including recursive objects and arrays:

Input valueExporter output`null``'null'``true``'true'``false``'false'``111``'111'``1.11``'1.110000e+0'``'1.11'``'"1.11"'``"a\nb"``'"a\nb"'``STDIN``'resource#1'``[1, 2]``'#0[1, 2]'``['a' => 1, 'b' => 2]``'#0["a": 1, "b": 2]``(object) ['a' => 1, 'b' => 2]``'#0{a: 1, b: 2}'``new ClassA()``'ClassA#0{}'`### Export identifiers and references

[](#export-identifiers-and-references)

Exported arrays, and objects include a numeric identifier that can be used to identify repeated occurrences of the same value. This is represented as a number sign (`#`) followed by the identifier:

```
$value = (object) array();
// $value is exported as '#0{}'
```

When a value appears multiple times, its internal structure will only be described the first time. Subsequent appearances will be indicated by a reference to the value's identifier. This is represented as an ampersand (`&`) followed by the identifier:

```
$inner = [1, 2];
$value = [&$inner, &$inner];
// $value is exported as '#0[#1[1, 2], &1[]]'

$inner = (object) ['a' => 1];
$value = (object) ['b' => $inner, 'c' => $inner];
// $value is exported as '#0{b: #1{a: 1}, c: &1{}}'
```

#### Export reference types

[](#export-reference-types)

Array references appear followed by brackets (e.g. `&0[]`), and object references appear followed by braces (e.g. `&0{}`):

```
$array = [];
$object = (object) [];

$value = [&$array, &$array];
// $value is exported as '#0[#1[], &1[]]'

$value = [$object, $object];
// $value is exported as '#0[#0{}, &0{}]'
```

This is necessary in order to disambiguate references, because arrays and other types can sometimes have the same identifier:

```
$value = [
    (object) [],
    [
        (object) [],
    ],
];
// $value is exported as '#0[#0{}, #1[#1{}]]'
```

#### Export reference exclusions

[](#export-reference-exclusions)

As well as excluding the content, object references exclude the class name, for brevity:

```
$inner = new ClassA();
$inner->c = "d";
$value = (object) ['a' => $inner, 'b' => $inner];
// $value is exported as '#0{a: ClassA#1{c: "d"}, b: &1{}}'
```

#### Export identifier persistence

[](#export-identifier-persistence)

Identifiers for objects are persistent across invocations of an exporter, and share a single sequence of numbers:

```
$a = (object) [];
$b = (object) [];

$value = [$a, $b, $a];
// $value is exported as '#0[#0{}, #1{}, &0{}]'

$value = [$b, $a, $b];
// $value is exported as '#0[#1{}, #0{}, &1{}]'
```

But due to PHP's limitations, array identifiers are only persistent within a single exporter invocation:

```
$a = [];
$b = [];

$valueA = [&$a, &$b, &$a];
$valueB = [&$b, &$a, &$b];
// both $valueA and $valueB are exported as '#0[#1[], #2[], &1[]]'
```

### Exporting recursive values

[](#exporting-recursive-values)

If a recursive value is exported, the points of recursion are exported as \[references\], in the same way that multiple instances of the same value are handled:

```
$value = [];
$value[] = &$value;
// $value is exported as '#0[&0[]]'

$value = (object) [];
$value->a = $value;
// $value is exported as '#0{a: &0{}}'
```

### Exporter special cases

[](#exporter-special-cases)

For certain types of values, exporters will exhibit special behavior, in order to improve the usefulness of its output, or to improve performance in common use cases.

#### Exporting closures

[](#exporting-closures)

When a closure is exported, the file path and start line number are included in the output:

```
$closure = function () {}; // file path is /path/to/example.php, line number is 123
// $closure is exported as 'Closure#0{}[/path/to/example.php:123]'
```

Note that the class name will always be exported as `Closure`, even for runtimes such as [HHVM](http://hhvm.com/) that use different class names for closures.

#### Exporting exceptions

[](#exporting-exceptions)

When an exception is exported, some internal PHP details are stripped from the output, including file path, line number, and stack trace:

```
$exception = new Exception('a', 1, new Exception());
// $exception is exported as 'Exception#0{message: "a", code: 1, previous: Exception#1{}}'
```

Additionally, when the message is `''`, the code is `0`, and/or the previous exception is `null`, these values are excluded for brevity:

```
$exception = new RuntimeException();
// $exception is exported as 'RuntimeException#0{}'
```

Export depth and breadth
------------------------

[](#export-depth-and-breadth)

For complicated nested structures, exporting the entire structure is not always desirable. *Depict* can set limits on how much *depth* and *breadth* of the supplied value it will export.

When a value is beyond the export depth, and has sub-values, its contents will be replaced with a special notation that simply indicates how many sub-values exist within that value:

```
$value = [[], ['a', 'b', 'c']];
// with a depth of 1, $value is exported as '#0[#1[], #2[~3]]'

$value = [(object) [], (object) ['a', 'b', 'c']];
// with a depth of 1, $value is exported as '#0[#0{}, #1{~3}]'
```

When the breadth limit of a value has been reached, a similar notation is used to indicate how many sub-values remain unexported:

```
$value = ['a', 'b', 'c', 'd', 'e'];
// with a breadth of 2, $value is exported as '#0["a", "b", ~3]'
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

3410d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/100152?v=4)[Erin](/maintainers/ezzatron)[@ezzatron](https://github.com/ezzatron)

---

Top Contributors

[![ezzatron](https://avatars.githubusercontent.com/u/100152?v=4)](https://github.com/ezzatron "ezzatron (20 commits)")

---

Tags

exportdumpprintoutputrecursive

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/eloquent-depict/health.svg)

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

###  Alternatives

[symfony/var-dumper

Provides mechanisms for walking through any arbitrary PHP variable

7.4k855.5M8.0k](/packages/symfony-var-dumper)[kint-php/kint

Kint - Advanced PHP dumper

2.8k19.3M283](/packages/kint-php-kint)[leeoniya/dump-r

a cleaner, leaner mix of print\_r() and var\_dump()

12368.1k5](/packages/leeoniya-dump-r)[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)[mmucklo/krumo

KRUMO - version 2.0 of print\_r(); and var\_dump(); (with new updates)

89168.0k6](/packages/mmucklo-krumo)[xrdebug/php

PHP client library for xrDebug

23920.3k2](/packages/xrdebug-php)

PHPackages © 2026

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