Vision
Why Pun exists, how it works, and why it is built this way.
Why Pun
A PHP project often needs five tools: Pint or PHP-CS-Fixer, Rector, PHPStan with Larastan, and Composer. Each has its own config, its own install, and its own speed.
Pun puts them in one binary with one config file, pun.toml. It is written in Rust, so it is fast and uses little memory. Format, lint, and analyse need no PHP.
One job per command
Each command answers one question.
| Command | Question | Edits files |
|---|---|---|
pun format |
Does the code look right? | Yes |
pun lint |
Is there a better way to write this file? | With --fix |
pun analyse |
Is the code wrong? | Never |
pun check |
All three, in one pass | With --fix |
- Format changes only layout, casing, and spelling. It never changes what the code does, so it is safe on save. Fixers that can change behavior, such as
==to===, are lint rules. - Lint looks at one file at a time. Upgrades, such as newer PHP syntax, are lint rules in the presets, or Rector sets like
rector/php-sets. There is no separate upgrade command. - Analyse checks types across files. Each finding keeps its PHPStan identifier, such as
argument.type. - Check applies lint fixes, formats the result, then analyses the final code. It reports only what is left.
Clear jobs mean you always know which command changed a line, and why.
Start with migrate
pun migrate reads your Pint, PHP-CS-Fixer, Rector, and PHPStan configs and writes pun.toml. It keeps every setting it can. For anything Pun does not support yet, it names the rule and skips it. We add missing rules to Pun instead of calling the old tool.
New projects use pun init instead.
Packages too
pun install, pun update, and pun require read and write the same composer.json and composer.lock as Composer. Your project stays a normal Composer project.
Why it is built this way
- Same answers. Each command aims to match the tool it replaces, so you can switch one command at a time.
- Speed and memory first. Files run in parallel, and nothing waits on a PHP process.
- Laravel built in. Laravel, Pest, and PHPUnit are detected from
composer.lock. Larastan’s rules run inside analyse, with no extra install. - Small config.
pun.tomlholds a preset per command and the rules you change. To pick them, see presets and sets.