---
title: Introduction
description: Pun is one fast binary for your PHP toolchain, compatible with Pint, Rector, PHPStan, and Composer.
---

Pun is one fast binary, written in Rust, for your PHP workflow. Each command gives the same answers as the tool it replaces: Pint and PHP-CS-Fixer, Rector, PHPStan and Larastan, or Composer. You can switch one command at a time.

Pun supports projects that target PHP 8.4 or later.

## Commands

| Command | What it does |
| --- | --- |
| [`pun format`](/docs/commands/format) | Fixes layout, casing, and spelling, as Pint and PHP-CS-Fixer do |
| [`pun lint`](/docs/commands/lint) | Reports code issues and fixes them with `--fix`, as Rector, Mago, and PHP-CS-Fixer's risky fixers do |
| [`pun analyse`](/docs/commands/analyse) | Reports type errors without editing files, as PHPStan and Larastan do |
| [`pun check`](/docs/commands/check) | Runs format, lint, and analyse in one pass |
| [`pun migrate`](/docs/commands/migrate) | Converts your Pint, PHP-CS-Fixer, Rector, and PHPStan configs to `pun.toml` |
| [`pun init`](/docs/commands/init) | Creates `pun.toml` for a new project |
| [`pun install`](/docs/commands/install) | Installs the locked dependencies into `vendor/`, with the same files Composer writes |
| [`pun update`](/docs/commands/update) | Resolves the dependencies again and writes the lock Composer writes |
| [`pun require`](/docs/commands/require), [`pun remove`](/docs/commands/remove) | Adds or removes packages, then updates and installs |
| [`pun x`](/docs/commands/x) (`punx`) | Runs a command from a Composer package without adding it to the project |
| [`pun self-update`](/docs/commands/self-update) | Replaces `pun` with the latest release |

## Status

- **Format** matches Pint on every project in the [parity scoreboard](/docs/parity). It changes layout only. Pint's risky and code-deleting fixers are lint rules, so run `pun check --fix` to apply a migrated Pint config.
- **Lint** and **analyse** cover part of Rector, PHPStan, and Larastan. The [rule reference](/docs/rules) marks missing rules as Planned.
- **The package manager** reads `composer`, `package`, and `path` repositories, and runs the Composer plugins that `allow-plugins` allows. It does not support `vcs` repositories.

PHP checks need no PHP runtime. Blade formatting needs Node.js (or Bun) and Prettier. Some config migrations need PHP and the original tool.

## Get started

[Install Pun](/docs/installation), then run these commands from your project root.

1. **Create pun.toml**

    If you have a Pint, PHP-CS-Fixer, Rector, or PHPStan config, start from a clean Git working tree, because migration can rewrite ignore comments in PHP files. Preview the migration, then run it:

    ```bash
    pun migrate --dry-run
    pun migrate
    ```

    Migration skips unsupported items and warns about each one.

    For a project without tool configs, run:

    ```bash
    pun init
    ```

    Neither command changes your scripts or CI configuration.

2. **Check the project**

    ```bash
    pun check
    ```

    `pun check` reports format, lint, and analysis findings without editing files. It exits 0 when clean, 1 on findings, and 2 when Pun could not run.

3. **Apply fixes**

    ```bash
    pun check --fix
    git diff
    ```

    Analysis never edits files. Lint rules with `fix = "off"` only report.

4. **Check changed files**

    ```bash
    pun check --dirty
    pun check --staged
    pun format --diff=main
    ```

    `--dirty` selects uncommitted changes, `--staged` selects files with staged changes, and `--diff=main` selects files changed since you branched from `main`.

**[Configuration](/docs/configuration/pun-toml)**

Paths, exclusions, rules, and options.

**[Migration](/docs/commands/migrate)**

Supported configs and migration limits.

**[CI](/docs/guides/ci)**

Run Pun on every push.

**[Parity](/docs/parity)**

Recorded comparisons with each upstream tool.

## Credits

Pun builds on [Mago](https://github.com/carthage-software/mago), [PHP-CS-Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer), [Laravel Pint](https://github.com/laravel/pint), [PHPStan](https://github.com/phpstan/phpstan), [Larastan](https://github.com/larastan/larastan), [Rector](https://github.com/rectorphp/rector), and [Composer](https://github.com/composer/composer). Special thanks to Mago's maintainers: Pun uses Mago's parser and analysis libraries directly. Thank you all for sharing your work.
