spiral/dumper
High-performance PHP variable dumper for the Spiral framework. Provides readable, developer-friendly dumps for debugging in CLI or web, with clean formatting and easy integration into your app to inspect arrays, objects, and complex data structures.
Install via Composer:
composer require spiral/dumper
In your PHP code, simply use the Spiral\Dumper\Dumper class to output variables with syntax highlighting and structure folding:
use Spiral\Dumper\Dumper;
$dumper = new Dumper();
$dumper->dump($myVariable); // Outputs to stdout with CLI coloring
For web contexts, enable HTML output by setting the FORMAT env or using the factory:
$dumper = Dumper::createHtml(); // Automatically formats for browser with CSS
$dumper->dump($data);
Check README.md in the repo for basic CLI usage, color customization, and configuration examples.
Dumper::createCli() for terminal-friendly, colorized output; integrates well with Symfony Console.app()->isDebug() check to avoid shipping debug output in production.dump_to_stream() or using MemoryDumper to collect output before writing to logs.Dumper::capture() and assert structure/content for integration scenarios.DUMPER_FORMAT=html or DUMPER_THEME=dark to globally affect behavior without code changes.Dumper inside a CLI command that already manipulates output (e.g., Symfony’s OutputInterface), avoid calling dump() directly—capture to string and manually write.dump() outputs directly to php://stdout/php://output; large objects may flush buffers unexpectedly—prefer dumpToString() for safe inspection.config/dumper.php and reference via theme: 'mytheme'.spiral/framework, some internal classes may rely on tightly coupled Spiral components—avoid relying on internal Dumper\Renderer\* unless prepared for version-skew.How can I help you explore Laravel packages today?