tflori/phpunit-printer
Custom PHPUnit printers for cleaner test output. Includes TextPrinter for human-friendly, readable progress reporting. Install via Composer and enable via phpunit --printer or printerClass in phpunit.xml; works across multiple PHP/PHPUnit versions.
Install via Composer: composer require --dev tflori/phpunit-printer. Configure PHPUnit to use one of its custom printers by adding a <printer> element in phpunit.xml—for example: <printer class="Tflori\PHPUnitPrinter\DebugPrinter" />. Start with the DebugPrinter to see detailed test execution flow, including method calls, assertions, and now assertion counts (new in v2.1.0). The ProgressPrinter also now conditionally renders colored status icons only when TTY output is detected, improving CI compatibility.
Developers integrate this package to customize test output formatting—e.g., using CompactPrinter for CI environments where minimal noise is desired, or ProgressPrinter to show real-time progress with assertion counts (new in v2.1.0). Printers are stateful and implement PHPUnit\TextUI\ResultPrinter, so they can be extended or reused across projects. A common pattern is to swap printers dynamically via environment variables (e.g., PHPUnit_Printer=compact), allowing local development with verbose feedback while keeping CI output clean. The new assertion count feature is particularly useful for tracking test granularity without cluttering output.
phpunit.xml paths cause silent "class not found" errors.ProgressPrinter now conditionally renders colored status icons only when TTY output is detected (v2.1.0), reducing CI output issues, but verify behavior in non-TTY environments if customizing further.ResultPrinter class instead of relying solely on included printers—this ensures future-proofing if built-in printers are deprecated.How can I help you explore Laravel packages today?