If you've worked on a modern PHP project, you know the drill. One tool formats your code. Another one lints it. A third checks your types. Composer handles packages. Each tool has its own config file, its own install step, and its own way of being slow in your CI pipeline.
Pun has a simple pitch: what if one tool did all of that, and did it fast?
Pun describes itself as "the ultrafast unified PHP toolchain." It's a single native binary, written in Rust, that formats, lints, and analyses your code and installs your Composer dependencies. Everything is controlled by one file called pun.toml. It's a young project, but it's already easy to try, and it's a fun one to watch.
Let's take a quick tour.
What Pun is
Pun is built to stand in for a whole shelf of tools you may already use: Pint, PHP-CS-Fixer, Rector, PHPStan, Larastan, and Composer. The docs say you can switch one command at a time, so you don't have to rip everything out on day one.
It comes with four main jobs, plus a handy combo:
| Command | What it does |
|---|---|
pun format |
Fixes layout, casing, and spelling in your code |
pun lint |
Reports code problems, and fixes many of them with --fix |
pun analyse |
Reports type errors without touching your files |
pun install |
Installs your locked dependencies into vendor/ |
pun check |
Runs format, lint, and analyse in one pass |
The "same answers as the old tool" part is a big deal. Pun's README says its formatter produces output byte for byte like Laravel Pint. The linter's rule names follow Rector, rector-laravel, and Mago. The analyser's identifiers map one to one from PHPStan and Larastan. And pun install uses the same lock file and vendor/ folder as Composer. In other words, the goal is for you to swap the engine without relearning the car.
Why it's fast
The site's headline feature is speed, and the explanation is pretty simple. Pun is a native binary, so no PHP process has to boot up before it can start reading your code. It also spreads its work across all of your CPU cores. That matters whether you're saving a single file in your editor or running checks on a big monorepo in CI.
The site didn't publish benchmark numbers that I could find, and I don't want to publish any I might see in my testing as a universal fact so the best way to find out how fast it is for your project is to run it on your project.
How to install it
On Linux or macOS (x86_64 or arm64), the install is one line:
curl -fsSL https://punphp.com/install | sh
If you'd rather keep it as a project dependency, you can also add it with Composer:
composer require --dev shipfastlabs/pun
After that, the binary lives at vendor/bin/pun. Projects need to target PHP 8.3 or later.
Your first five minutes
Here's a gentle way to try it on an existing project. Work in a clean Git branch so you can review everything it does.
Step 1: create your config. If you already have a Pint, PHP-CS-Fixer, Rector, or PHPStan config, Pun can convert it for you. Preview first, then run it for real:
pun migrate --dry-run
pun migrate
No old configs? Start fresh instead:
pun init
Either way, you end up with a pun.toml file. One heads-up from the docs: migration can rewrite ignore comments inside your PHP files, which is another reason to start from a clean working tree. Neither command touches your scripts or CI setup.
Step 2: look around. Run the full check. It only reports findings and doesn't edit anything:
pun check
The exit codes are friendly for automation: 0 means everything is clean, 1 means it found problems, and 2 means Pun couldn't run.
Step 3: let it fix things. Apply the available fixes, then read through the changes like you would any pull request:
pun check --fix
git diff
That's it. You've just replaced several tools with one command.
The four jobs, one at a time
You don't have to use pun check all the time. Each job works on its own, which is great for learning what Pun does.
Formatting
pun format tidies up layout and style. Say you have a method that was written in a hurry:
public function label(): string
{
if($this->name=='') return 'Anonymous';
return ucfirst($this->name);
}
After formatting with the Laravel preset, you'd expect braces, spacing, and operators cleaned up:
public function label(): string
{
if ($this->name == '') {
return 'Anonymous';
}
return ucfirst($this->name);
}
Nothing about the behavior changed. It just reads better, and you never had to argue about it in a code review.
Linting
pun lint goes beyond style and points out code that could be better. One rule it ships with prefers str_contains() over the older strpos() dance. So this:
return strpos($email, '@') !== false;
is flagged, and with pun lint --fix it becomes:
return str_contains($email, '@');
Rules are grouped into sets, such as dead-code and modernize, which you can turn on in your config. Some rules only report problems and never rewrite your code, which is a nice safety net.
Analysing
pun analyse is your static analysis pass. It looks for things like calling a method that doesn't exist, and it never edits your files. For example, if you write this:
public function summary(): string
{
return $this->shorten();
}
and shorten() doesn't exist on the class, Pun reports an undefined method error with the file and line number, so you can jump straight to it.
Installing packages
pun install reads your composer.lock and installs the packages into vendor/, then builds the autoloader. If there's no lock file yet, it resolves your dependencies and creates one. There are also pun update, pun require, and pun remove for the usual day-to-day package chores, and pun composer dump-autoload when you need to rebuild the autoloader.
One config file
This is one of my favorite parts. Instead of juggling pint.json, phpstan.neon, and rector.php, you keep everything in a single pun.toml. A small example might look like this:
[format]
preset = "laravel"
[lint]
sets = ["dead-code", "modernize"]
[analyse]
preset = "recommended"
paths = ["src", "tests"]
baseline = "pun-baseline.toml"
Each section lines up with a command. The baseline option is a nice touch for older codebases: it lets you record the problems you already have, so you can focus on not adding new ones.
If you ever wonder what Pun is actually using, pun config prints the resolved configuration, and pun explain describes a rule and its upstream names.
Only check what you changed
Running everything on a large codebase every time can feel like overkill. Pun has three flags for checking just the files that matter:
pun check --dirty
pun check --staged
pun check --diff=main
The first looks at files with uncommitted changes. The second looks at staged files, which makes it a good fit for a pre-commit hook. The third looks at files changed since you branched from main, which is handy in a pull request pipeline.
Speaking of CI, a simple setup can be as short as this:
- run: composer install
- run: vendor/bin/pun check
Because the exit code is non-zero when something's wrong, your pipeline fails the way you'd expect.
A few bonus commands
There are a few more commands worth knowing about:
pun x(also available aspunx) runs a Composer package's command without adding the package to your project.pun self-updatereplaces Pun with the latest release.pun list-filesandpun extension listhelp you see what Pun sees.
Friendly to coding agents, too
Here's a modern twist. When Pun detects that it's running under a coding agent such as Claude Code, Cursor, or Codex, it changes its output to one short line per problem. That keeps the results compact and cuts down on the number of tokens an agent has to read. The docs also ship with an llms.txt file and Markdown copies of each page, so assistants can read them easily.
You'll see output like this under an agent:
pun check: fail, 2 errors (48 checked)
followed by one line for each issue, with the file, line, and rule name. Humans get the nicer, more readable output. Everybody wins.
Things to know before you jump in
Pun is exciting, but it's also early. The version history runs from v0.1.0-beta.1 up to v0.4.0 as of November 24, 2026, so everything is still below 1.0. The GitHub project is small and new, with a few dozen stars at the time I looked. That's not a knock. It's just a reminder to try it on a branch, compare the results against your current tools, and report anything that surprises you.
A few other practical notes:
- Your projects need to target PHP 8.3 or later.
- The standalone binary supports Linux and macOS, on x86_64 or arm64.
- Migration skips anything it doesn't support and warns you about each skipped item, so read the output.
- Building Pun from source requires a recent Rust toolchain, if you want to contribute.
It's also worth giving credit where the project does. Pun says it builds on the shoulders of Mago, PHP-CS-Fixer, Laravel Pint, PHPStan, Larastan, Rector, and Composer, and it uses Mago's parser and analysis libraries directly. The PHP community has built some excellent tools, and Pun is a new way of bringing them together.
The project doesn't spell out a long origin story, but the goal is easy to see: fewer tools, one config, and speed that stays out of your way. The site even promotes it with a video titled "Bun is coming for PHP," which tells you a bit about the ambition.
Should you try it?
If you maintain a PHP project, absolutely. The migration path is gentle, you can adopt it one command at a time, and the worst case is a quick experiment on a branch. If the output matches what your current tools produce, you may find yourself deleting a few config files and a few steps from your CI pipeline.
PHP tooling keeps getting faster, friendlier, and more interesting. Pun is a fun example of where things are heading. Go give it a spin, and let the maintainers know how it goes.
References
- Pun project site: https://punphp.com/
- Pun documentation (introduction and getting started): https://punphp.com/docs
- Pun on GitHub (README): https://github.com/shipfastlabs/pun
- shipfastlabs/pun on Packagist (version history and requirements): https://packagist.org/packages/shipfastlabs/pun