Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

Installation

Install Pun with the standalone installer or Composer.

Pun runs on Linux (including Alpine) and macOS, on x86_64 and arm64. Windows is not supported.

Standalone installer

Install the latest release to ~/.pun/bin, without Composer or PHP:

curl -fsSL https://pun.laravel.cloud/install | sh

To install a specific version, pass it to the script:

curl -fsSL https://pun.laravel.cloud/install | sh -s -- v0.2.1

The installer also installs punx, which runs pun x. It never asks for sudo and does not edit your shell profile. If ~/.pun/bin is not on your PATH, it prints the line to add.

  • To install somewhere else, set PUN_INSTALL. The binary goes in $PUN_INSTALL/bin.
  • To update, run pun self-update or the installer again.
  • To uninstall, delete ~/.pun.

The installer downloads over HTTPS only and checks the archive’s SHA-256 checksum. When the GitHub CLI is installed and signed in, it also checks the GitHub build attestation. To fail when the attestation cannot be checked, set PUN_REQUIRE_ATTESTATION=1.

Composer

composer require --dev punphp/pun
vendor/bin/pun --version

The package needs PHP 8.4 or later. On first run, it downloads the matching release binary from GitHub Releases, checks its SHA-256 checksum, and keeps it in vendor/bin. If the download or the checksum fails, it exits 2.

To update, run composer update punphp/pun. pun self-update does not replace a Composer install.

These docs write commands as pun. In a project, run vendor/bin/pun, or call pun from a Composer script:

"scripts": {
    "check": "pun check"
}

Runtime requirements

  • Your project must target PHP 8.4 or later. Pun reads the target from require.php in composer.json, and [php] version overrides it. If require.php allows PHP below 8.4, every check exits 2.

  • PHP checks need no PHP or Node runtime.

  • Blade formatting needs Node.js and these dev dependencies. If the project has a bun.lock or bun.lockb file, Pun runs Prettier with Bun. Prettier and its plugins load from the project’s node_modules, so Blade formatting runs project code.

    npm install --save-dev prettier@^3.9.6 prettier-plugin-blade@^3.3.3 prettier-plugin-tailwindcss@^0.8.1
  • Like Pint, Pun skips no_unused_imports, fully_qualified_strict_types, global_namespace_import, and declare_strict_types in *.blade.php files.

  • Migrating .php-cs-fixer.php or rector.php needs PHP and that tool. For Rector, run composer install first.

Continue with Get started.

Last updated on

Was this page helpful?