Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Pao Laravel Package

nunomaduro/pao

Laravel PAO detects when PHPUnit, Pest, Paratest, PHPStan, Rector, or Artisan run inside an AI agent and swaps verbose human output for compact structured JSON. Zero config, installs as a dev dependency, and leaves normal terminal output untouched.

View on GitHub
Deep Wiki
Context7

Agent-optimized output for PHP testing tools

Frequently asked questions about Pao
What does the laravel/pao package do?
PAO is a dev-only Composer package from Laravel that detects when PHPUnit, Pest, Paratest, PHPStan, Rector, or Artisan commands are running inside an AI agent such as Claude Code, Cursor, or Devin. Instead of dumping verbose human-readable output, it emits compact, structured JSON that agents can parse with far fewer tokens. Outside an AI environment it does nothing, so your normal terminal experience stays exactly the same.
How do I install laravel/pao?
Run composer require laravel/pao --dev. There is no configuration, no phpunit.xml editing, and no manual service provider registration: PAO hooks into PHPUnit, Pest, Paratest, PHPStan, and Rector through Composer's autoloader, and Laravel's package auto-discovery registers the Artisan output cleaner. After that, PAO activates automatically whenever an AI agent is detected. It requires PHP 8.3 or higher.
Does PAO change the output I see when I run tests in my terminal?
No. PAO only activates when it detects an AI agent environment; when you run vendor/bin/pest, phpunit, phpstan, or an Artisan command directly in your terminal, the output is completely unchanged, including colors and formatting. That dual-mode design lets you install it in an existing project without disrupting any developer's workflow. Most teams commit it as a dev dependency and forget about it.
Which AI agents does PAO detect?
PAO detects AI agent environments such as Claude Code, Cursor, Devin, and Gemini CLI, and switches to JSON mode only in those contexts. Detection is based on environment signals, and because the package is open source you can extend or adapt the detection logic if your team uses a different agent. If no agent is detected, PAO stays out of the way entirely.
Which testing and static analysis tools does PAO support?
PAO supports PHPUnit 12–13, Pest 4–5, Paratest, PHPStan, Rector, and Laravel Artisan commands. That covers the vast majority of a typical Laravel testing and static analysis stack, so you get compact JSON from both test runs and static analysis. For Artisan, it also strips ANSI colors, box-drawing characters, and excess whitespace, and since v1.1.5 raw non-tool output is passed through verbatim.
Does laravel/pao only work with Laravel?
No. PAO works in any PHP project, including Symfony, Laminas, and vanilla PHP, as long as the project uses PHPUnit, Pest, Paratest, PHPStan, or Rector. Laravel projects get the extra benefit of auto-discovered service provider registration and Artisan command sanitization. That makes it a reasonable choice even for monorepos where only some packages are Laravel applications.
What PHP and Laravel versions does PAO require?
PAO requires PHP 8.3 or higher, and Laravel 12 or newer if you want the Artisan integration. PHP 8.3 aligns with Laravel 12+ and modern PHPUnit and Pest releases, which keeps the maintenance surface small. If you are on an older Laravel or PHP version, you would need to upgrade before adopting PAO.
How much overhead does PAO add to a test run, and how many tokens does it save?
JSON serialization typically adds only a few milliseconds, roughly 5–10ms per run, which is negligible next to normal test execution time. In exchange, the compact structured output can cut the tokens an AI agent has to read by an order of magnitude: the README's 1,000-test example collapses from hundreds of progress lines to a single small JSON payload. The savings matter most on large suites and verbose Artisan commands like migrate:status.
Will PAO break my custom Artisan command formatting or custom PHPUnit output?
PAO is designed as a non-intrusive layer, and version 1.1.5 explicitly bypasses the formatter for raw output, so plain or non-tool output is passed through verbatim rather than being reshaped. That significantly reduces the risk of mangling custom Artisan formatting or ANSI-styled CLI output. Custom PHPUnit listeners or unusual CLI tooling can still interact unexpectedly, so verify your JSON consumers handle the current schema before rolling PAO out broadly.
How do I verify PAO is active, and is it safe to upgrade between patch releases?
You can confirm PAO is active by running your test suite from inside your AI agent and checking that the output is compact JSON rather than PHPUnit's progress dots. Recent patch releases (1.1.1 and 1.1.5) were bug-fix only, addressing runtime exits, boolean env values, raw output passthrough, and missing test-result traces, so drop-in upgrades are low risk. Still, if your pipelines depend on exact JSON fields, pin the version and skim the changelog before upgrading.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels