PHPackages                             michel/vardumper - 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. michel/vardumper

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

michel/vardumper
================

Zero-dependency PHP debug library. Drop it in any project — no framework required.

1.1.0(1mo ago)07MITPHPPHP &gt;=7.4

Since Dec 15Pushed 1mo agoCompare

[ Source](https://github.com/michelphp/vardumper)[ Packagist](https://packagist.org/packages/michel/vardumper)[ RSS](/packages/michel-vardumper/feed)WikiDiscussions main Synced 1w ago

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

michel/vardumper
================

[](#michelvardumper)

Zero-dependency PHP debug library. Drop it in any project — no framework required.

**Philosophy**: one function call → one clear output. Nothing hidden, nothing magic.

---

Install
-------

[](#install)

```
composer require michel/vardumper
```

**Requirements**: PHP ≥ 7.4 · `ext-json` (bundled with PHP by default)

Auto-detects the environment: HTML output in the browser, plain text in the terminal.

---

Functions
---------

[](#functions)

### `dump()` — inspect without stopping

[](#dump--inspect-without-stopping)

Prints the variable. Script keeps running.

```
$user = ['name' => 'Alice', 'age' => 30, 'active' => true];
dump($user);
```

**Browser output** (styled HTML, collapsible):

```
array(3) (
  "name"   => string "Alice"  (Length: 5)
  "age"    => int 30
  "active" => bool true
)

```

**Terminal output**:

```
array(3) [
  [name]   => (string) "Alice"
  [age]    => (int) 30
  [active] => (bool) true
]

```

Multiple variables in one call:

```
dump($request, $user, $token);
// → prints each one, in order, script continues
```

---

### `dd()` — inspect and stop

[](#dd--inspect-and-stop)

Same as `dump()` but exits the script immediately after. Nothing runs after this line.

```
$result = computePrice($cart);
dd($result);
// → dumps $result, then exit(1). Code below never runs.
```

---

### `btrace()` — show the call stack

[](#btrace--show-the-call-stack)

Prints the last N function calls that led to the current line. Use it when you need to understand **how** the code reached a specific point.

```
function processOrder($order) {
    btrace(); // → shows the last 5 calls that led here
    // ...
}
```

**Output** (HTML or terminal):

```
Backtrace — last 5 call(s)

#1 - handleRequest: Called from index.php:12
#2 - dispatch:      Called from Router.php:45
#3 - processOrder:  Called from OrderController.php:88
...

```

Limit the depth:

```
btrace(3); // show only the last 3 calls
btrace(1); // show only the direct caller
```

---

### `dd_bt()` — backtrace + dump + stop

[](#dd_bt--backtrace--dump--stop)

Combines `btrace()` and `dd()` in one call. Step 1: shows the call stack. Step 2: dumps the value. Step 3: stops the script.

Use it when you want both **where** and **what** at the same time.

```
$price = computePrice($cart);
dd_bt($price);
// → prints the call stack
// → dumps $price
// → exit(1)
```

Limit backtrace depth:

```
dd_bt($price, backtraceLimit: 3);
```

---

### `console_log()` — dump to the browser console

[](#console_log--dump-to-the-browser-console)

Injects the variable into the browser's JavaScript console as a `console.log()`. The page HTML is **not altered**. The script **keeps running**.

Use it when:

- you are debugging an API / JSON response (adding HTML would break the output)
- you want to debug in production without touching the page
- you need to dump something without stopping the request

```
$response = buildApiResponse($data);
console_log($response);
// → page stays clean
// → open DevTools (F12) → Console tab
// → you see: [VarDumper] → controller.php:42
//              "Array\n(\n    [status] => ok ...\n)"
```

Multiple values:

```
console_log($request, $user, $token);
// → three separate console.log() blocks, each labelled with its file:line
```

> Works for **any PHP type** — arrays, objects (including private properties), scalars. Uses `print_r()` internally, not `json_encode()`, so objects are fully represented.

---

What gets dumped — type coverage
--------------------------------

[](#what-gets-dumped--type-coverage)

PHP typeWhat you see`string``string "hello"  (Length: 5)``int``int 42``float``float 3.14``bool``bool true``null``null``array`recursive tree, collapsible in HTML`object`class name + object id + all properties (public, protected, private, traits, parent)`resource``resource(stream)`Circular ref`[Circular: ClassName#42]` — no stackoverflowObject depth is limited to **5 levels** by default (configurable).

---

Custom output — advanced usage
------------------------------

[](#custom-output--advanced-usage)

Every class implements `OutputInterface`. You can inject your own renderer.

```
use Michel\Debug\VarDumper;
use Michel\Debug\Output\OutputInterface;

class LogOutput implements OutputInterface
{
    public function print($value): void
    {
        // send to a log file, a Slack webhook, anywhere
        file_put_contents('/tmp/debug.log', print_r($value, true) . PHP_EOL, FILE_APPEND);
    }
}

$dumper = new VarDumper(new LogOutput());
$dumper->dump($myVariable);
```

Built-in outputs you can use directly:

ClassWhen to use`HtmlOutput`Browser (default)`CliPrintOutput`Terminal, formatted (default in CLI)`CliVarDumpOutput`Terminal, raw `var_dump()` style`ConsoleLogOutput`Browser JS console---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE)

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance93

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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 ~211 days

Total

2

Last Release

33d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/909a078010ad44ff35146af8288451a3b6fd26f81cb198cbea776a92553c9b8a?d=identicon)[F.Michel](/maintainers/F.Michel)

---

Top Contributors

[![michelphp](https://avatars.githubusercontent.com/u/26349908?v=4)](https://github.com/michelphp "michelphp (2 commits)")

### Embed Badge

![Health badge](/badges/michel-vardumper/health.svg)

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

###  Alternatives

[symfony/error-handler

Provides tools to manage errors and ease debugging PHP code

2.7k714.7M954](/packages/symfony-error-handler)[proget-hq/phpstan-yii2

Yii2 extension for PHPStan

52614.0k7](/packages/proget-hq-phpstan-yii2)[upscale/swoole-blackfire

Blackfire profiler integration for Swoole web-server

22126.6k13](/packages/upscale-swoole-blackfire)[fjogeleit/prometheus-messenger-middleware

Prometheus Middleware for the Symfony Messenger Component

2255.2k](/packages/fjogeleit-prometheus-messenger-middleware)

PHPackages © 2026

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