PHPackages                             mrlunar/php-dbg-dumper - 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. mrlunar/php-dbg-dumper

ActiveLibrary

mrlunar/php-dbg-dumper
======================

A lightweight PHP variable dumper, including the variable (or expression) name itself.

1173PHP

Since Feb 25Pushed 12y ago2 watchersCompare

[ Source](https://github.com/MrLunar/php-dbg-dumper)[ Packagist](https://packagist.org/packages/mrlunar/php-dbg-dumper)[ RSS](/packages/mrlunar-php-dbg-dumper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

DBG Dumper
==========

[](#dbg-dumper)

A prettified PHP variable dumper. Outputs nicely to the browser and CLI (included piped output). Does not replace `var_export` or `print_r`, but merely acts a wrapper to these core PHP functions.

About
-----

[](#about)

For each argument provided, it spits out the file name, line number, variable type, variable name and value. The output always displays nicely even if through a browser, a terminal or even piped into `less` or into a file.

The unique selling point here is the output of the variable name or the given expression. This gives quick visibility of many variables at once (rather than trying to remember which order you dumped your vars).

Install
-------

[](#install)

Create a [composer.json](http://packagist.org/about-composer) file for your project, and include the following:

```
{
    "require": {
        "mrlunar/php-dbg-dumper": "dev-master"
    }
}
```

Examples
--------

[](#examples)

The following code:

```
$my_var = array('my array var');
dbg::print_r($my_var);
```

would output in the browser like so:

[![](https://camo.githubusercontent.com/b856979028a9190b31bd8142df09f9376121c28c41dc81902d96e95835a3fe93/68747470733a2f2f7261772e6769746875622e636f6d2f77696b692f4d724c756e61722f7068702d6462672d64756d7065722f696d672f323031342d30322d313925323031375f30375f33342e706e67)](https://camo.githubusercontent.com/b856979028a9190b31bd8142df09f9376121c28c41dc81902d96e95835a3fe93/68747470733a2f2f7261772e6769746875622e636f6d2f77696b692f4d724c756e61722f7068702d6462672d64756d7065722f696d672f323031342d30322d313925323031375f30375f33342e706e67)

yet would output in the terminal like so:

[![](https://camo.githubusercontent.com/46a96b4d4f17ed9b0968c04731e52a992fce7b2abac4f6f38734178e0516db39/68747470733a2f2f7261772e6769746875622e636f6d2f77696b692f4d724c756e61722f7068702d6462672d64756d7065722f696d672f323031342d30322d313925323031375f31305f31392e706e67)](https://camo.githubusercontent.com/46a96b4d4f17ed9b0968c04731e52a992fce7b2abac4f6f38734178e0516db39/68747470733a2f2f7261772e6769746875622e636f6d2f77696b692f4d724c756e61722f7068702d6462672d64756d7065722f696d672f323031342d30322d313925323031375f31305f31392e706e67)

Also for example, the expression:

```
dbg::print_r(rand(1, 50));
```

would output to the browser:

[![](https://camo.githubusercontent.com/de6b78789a43cf57bc9d4908a370d63c8dce75e7fce80248355480a62802c803/68747470733a2f2f7261772e6769746875622e636f6d2f77696b692f4d724c756e61722f7068702d6462672d64756d7065722f696d672f323031342d30322d313925323031375f32335f31322e706e67)](https://camo.githubusercontent.com/de6b78789a43cf57bc9d4908a370d63c8dce75e7fce80248355480a62802c803/68747470733a2f2f7261772e6769746875622e636f6d2f77696b692f4d724c756e61722f7068702d6462672d64756d7065722f696d672f323031342d30322d313925323031375f32335f31322e706e67)

Other Commands
--------------

[](#other-commands)

```
dbg::var_export($my_var);
```

Same as `dbg::print_r($my_var);` but using PHP's `var_export()` output.

```
dbg::quit();
```

A verbose exit() so you don't lose yourself in a whitescreen.

[![](https://camo.githubusercontent.com/ea1cfe4b74a2ebd465dcaf65b150f6988dc82394ec1f495c144f1d3bdef13745/68747470733a2f2f7261772e6769746875622e636f6d2f77696b692f4d724c756e61722f7068702d6462672d64756d7065722f696d672f323031342d30322d313925323031375f31345f30312e706e67)](https://camo.githubusercontent.com/ea1cfe4b74a2ebd465dcaf65b150f6988dc82394ec1f495c144f1d3bdef13745/68747470733a2f2f7261772e6769746875622e636f6d2f77696b692f4d724c756e61722f7068702d6462672d64756d7065722f696d672f323031342d30322d313925323031375f31345f30312e706e67)

```
dbg::error('a terrible error has occured, run for the hills');
dbg::warning('just an FYI because this will probably cause problems later');
dbg::info('I just want to talk');
```

Should you feel these are useful in your scripts:

[![](https://camo.githubusercontent.com/fc7a9cd8a8966f1588881b83e4aad756b1ed04be0916ab0fb7af588b8c9a6856/68747470733a2f2f7261772e6769746875622e636f6d2f77696b692f4d724c756e61722f7068702d6462672d64756d7065722f696d672f323031342d30322d313925323031375f31355f33392e706e67)](https://camo.githubusercontent.com/fc7a9cd8a8966f1588881b83e4aad756b1ed04be0916ab0fb7af588b8c9a6856/68747470733a2f2f7261772e6769746875622e636f6d2f77696b692f4d724c756e61722f7068702d6462672d64756d7065722f696d672f323031342d30322d313925323031375f31355f33392e706e67)

```
dbg::dump($my_var);
```

*Experimental.* Like `dbg::print_r()` but outputs arrays and objects into a tabular format.

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/029231f5f3025522ccb4903ffefbd97dafa394b95fa152918f187a904f475c64?d=identicon)[minimax](/maintainers/minimax)

---

Top Contributors

[![MrLunar](https://avatars.githubusercontent.com/u/860189?v=4)](https://github.com/MrLunar "MrLunar (10 commits)")

### Embed Badge

![Health badge](/badges/mrlunar-php-dbg-dumper/health.svg)

```
[![Health](https://phpackages.com/badges/mrlunar-php-dbg-dumper/health.svg)](https://phpackages.com/packages/mrlunar-php-dbg-dumper)
```

PHPackages © 2026

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