05 Dec 2026

Pun - one Rust tool to replace Pint, PHPStan, Rector and Composer

PHP Laravel Rust developer tools open source

Typical Laravel project has many tools for code quality - Pint for formatting, PHPStan / Larastan for analysis, Rector for refactoring and Composer for packages. Each has its own config file and each takes time to run. Pun wants to replace all of them with one fast binary written in Rust.

What it is

Pun is PHP toolchain for PHP 8.3+ code. It formats, lints and analyzes your code, installs Composer packages and reads all settings from one pun.toml file. It uses parser and analysis libraries from Mago.

It aims to replace Pint, PHP-CS-Fixer, Rector, PHPStan, Larastan and Composer. Each command tries to match tool it replaces, so you can switch one command at a time.

Commands

  • 🎨 pun format - fixes layout and casing, matches Laravel Pint output. --test only checks.
  • 🔍 pun lint - finds code that could be written better, --fix applies fixes. Presets: essential, recommended, strict.
  • 🧠 pun analyse - reports type errors like PHPStan, never edits files. --generate-baseline saves current errors.
  • ✅ pun check - runs format, lint and analyse together. Can run only on changed files with --dirty, --staged or --diff=main.
  • 📦 pun install / require / update / remove - Composer packages with parallel downloads, checksum verification and shared package store
  • 🔄 pun migrate - reads your pint.json, .php-cs-fixer.php, rector.php and phpstan.neon and creates one pun.toml
  • 🆕 pun init - creates config by asking which presets you want

Laravel support

Laravel, Pest and PHPUnit extensions turn on automatically when found in composer.lock. With Laravel enabled, analysis also runs Larastan checks. Pun finds your macros by reading macro() and mixin() calls, because it doesn't run PHP. It also ships Laravel Boost guideline for AI coding agents.

Installation

Binary for Linux or macOS (x86_64 or arm64):

curl -fsSL https://punphp.com/install | sh

Or per project via Composer:

composer require --dev shipfastlabs/pun
vendor/bin/pun migrate
vendor/bin/pun check --fix

Tip: in CI, exit codes are simple - 0 clean, 1 problems found, 2 Pun could not run.

Good to know (beta)

  • Pun is in public beta and very new project
  • Some Rector, PHP-CS-Fixer, PHPStan and Larastan rules are still missing (marked "Planned" in docs)
  • pun install doesn't support custom installer paths and fails on packages locked only with VCS source
  • pun migrate doesn't copy PHPStan baselines or support Pint's symfony preset
  • Blade formatting needs Node.js with Prettier, unless you set blade = "native"
  • Windows is not listed for binary install

Why I like it

One config instead of four, and Rust speed instead of waiting for PHPStan. pun check --dirty before commit is great workflow. I wouldn't replace everything in production project yet, but trying pun format and pun analyse next to existing tools is easy. License is MIT.

Docs: https://punphp.com/docs

GitHub: https://github.com/shipfastlabs/pun

Read more: Pun on Laravel News