Pun is one Rust binary that formats, lints, and analyzes PHP code and installs Composer packages, and it keeps its settings in one pun.toml file. Pun is now in public beta.
The documentation says Pun replaces Pint, PHP-CS-Fixer, Rector, PHPStan, Larastan, and Composer, and that each command aims to give the same results as the tool it replaces, so you can switch one command at a time. It supports projects that target PHP 8.3 or later, and the format, lint, and analyse commands don't need PHP installed. Pun uses the parser and analysis libraries from Mago and ports rules and test fixtures from the other projects.
Nuno also recently made a video on it:
Pun Commands
pun formatfixes layout, casing, and spelling. The README says it formats code byte for byte like Laravel Pint, andpun format --testchecks files without changing thempun lintreports code you could write a better way, andpun lint --fixapplies the fixes. Lint presets areessential,recommended, andstrictpun analysereports type errors such as undefined methods, the way PHPStan does. It never edits a file, and--generate-baselinesaves the current errors so you can fix them laterpun checkruns format, lint, and analyse together, andpun check --fixapplies the format and lint fixespun installreadscomposer.jsonandcomposer.lockand installs the packages intovendor/. It downloads packages in parallel, checks each checksum, and keeps one copy of each package in a shared store that it links into your projectpun require,pun update, andpun removeadd, update, and remove packages
Here are the pun check options for checking only the files you changed:
pun check --dirty pun check --staged pun check --diff=main
--dirty selects files with uncommitted changes, --staged selects staged files, and --diff=main selects files changed since you branched from main. Every command exits with 0 when the run is clean, 1 when it finds problems, and 2 when Pun could not run.
Migrating From Pint, Rector, and PHPStan
pun migrate reads your pint.json, .php-cs-fixer.php, rector.php, and phpstan.neon files and writes one pun.toml. You can preview the result first:
pun migrate --dry-run
pun migrate
Migration leaves your old config files and composer.json alone. It does rewrite @phpstan-ignore and @php-cs-fixer-ignore comments in your PHP files to @pun-ignore, so the docs tell you to start from a clean Git working tree. It prints every rule it could not move.
Migration does not move everything:
- PHPStan baselines are not copied. You create a new one with
pun analyse --generate-baseline - Pint's
symfonypreset is not supported, and migration stops with an error - Custom rules and closures are skipped with a warning
For a project with none of those configs, pun init asks which presets you want and writes the file. On a Laravel app with Pest it looks like this:
[extensions] laravel = "on" pest = "on" [files] exclude = ["tmp", "temp"] [format] preset = "laravel" [lint] preset = "recommended" [analyse] preset = "recommended"
If you want the exact rule set of a PHPStan level, you can set the analyse preset to a value such as phpstan/level_5.
Laravel Support
Both pun migrate and pun init turn on the laravel, pest, and phpunit extensions when they find those packages in composer.lock. With the laravel extension on, pun analyse also runs Larastan's checks without a separate install, and pun lint adds Laravel rules such as laravel/no-request-all.
Pun doesn't run PHP, so it finds macros by reading X::macro() and X::mixin() calls in your service providers and bootstrap files. The docs list the cases it misses, including macros with computed names and macros registered by other vendor files.
The Composer package also includes a Laravel Boost guideline that tells a coding agent to run pun check --fix --dirty after it edits PHP. When Pun detects Claude Code, Cursor, or Codex, it prints one summary line and one line per problem.
Beta Limitations
- Pun doesn't have every Rector, PHP-CS-Fixer, PHPStan, or Larastan rule yet. The rule reference marks the missing ones as Planned
- A format rule Pun doesn't implement is a config error, and Pun exits before it edits any file
pun installdoesn't support custom installer paths such ascomposer/installers, and a package locked with only a VCS source fails- Blade formatting needs Node.js with Prettier unless you set
blade = "native"
You can read the full command reference in the Pun documentation and view the source code on GitHub.