---
title: pun init
description: Create pun.toml.
---

Create `pun.toml` for a new project. If you already use Pint, PHP-CS-Fixer, Rector or PHPStan, use [`pun migrate`](/docs/commands/migrate) instead.

## Usage

```bash
pun init [options]
```

```bash
pun init                 # ask the questions
pun init --yes           # take the defaults
pun init --style psr12 --lint strict --analyse strict
```

## Options

| Option | Description |
| --- | --- |
| `--yes` | Take the defaults, no questions. |
| `--style <preset>` | Format preset: `laravel` or `psr12`. |
| `--lint <preset>` | Lint preset: `essential`, `recommended` or `strict`. Default: `recommended`. |
| `--analyse <preset>` | `basic`, `essential`, `recommended`, `strict` or `max`, or a PHPStan level preset such as `phpstan/level_5`. Default: `recommended`. |

## What happens

- Asks for the format preset, lint preset and analyse preset.
- Picks `laravel` when `composer.lock` has `laravel/framework`, else `psr12`.
- Turns on each extension whose package is in `composer.lock`.
- Writes `pun.toml`, with `tmp/` and `temp/` excluded from every command.
- Asks no questions with `--yes`, in CI, under a coding agent, or without a terminal.
- Stops if `pun.toml` exists, or if an old tool config exists (it offers `pun migrate`).
- Never edits Composer scripts, CI, Git hooks or editor settings.

```toml pun.toml
[extensions]
laravel = "on"
pest = "on"

[files]
exclude = ["tmp", "temp"]

[format]
preset = "laravel"

[lint]
preset = "recommended"

[analyse]
preset = "recommended"
```

## Exit codes

| Code | Meaning |
| --- | --- |
| 0 | `pun.toml` written. |
| 2 | A config already exists, a bad option, or another error. |
