finds.dev← search

// the find

sebastianbergmann/exporter

★ 6,822 · PHP · BSD-3-Clause · updated Jul 2026

Provides the functionality to export PHP variables for visualization

sebastian/exporter is a PHP utility that converts any PHP value into a human-readable string representation, handling circular references, binary strings, NaN/Inf floats, and nested structures. It's the component PHPUnit uses internally to print actual vs. expected values in assertion failure messages. You probably already depend on it transitively.

Circular reference detection is solid — it tracks object/array identity and prints back-references rather than exploding into infinite recursion. Binary string detection is a nice touch that var_dump doesn't give you cleanly. The `shortenedExport()` method is useful for log lines where you want a hint of the value without the full dump. Tooling hygiene is exemplary: PHPStan at max strictness, Infection mutation testing, CS fixer, API surface checks in CI — this is what a well-maintained single-purpose library looks like.

The output format is custom string notation, not any standard serialization — you can't round-trip it back to a PHP value, so it's visualization-only. No JSON or machine-readable output path if you need something a log aggregator can parse. With 6800 stars and 36 forks the ratio is lopsided because almost nobody extends or forks it — it's a leaf dependency people pull in without thinking about. If you're looking at this as a standalone tool rather than a transitive PHPUnit dependency, var_export() or json_encode() cover 90% of the same ground without adding a package.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →