pun require
Add a package.
Add a package to composer.json, then install it.
Usage
pun require <packages> [options]
pun require laravel/sanctum
pun require spatie/laravel-data:^4.0
pun require --dev pestphp/pest
Options
| Option | Description |
|---|---|
--dev |
Add to require-dev. |
--sort-packages |
Keep the list sorted. |
--no-update |
Only edit composer.json. |
-p, --package=<member> |
Edit this workspace member. |
Require also takes the pun update options (except --dry-run) and the pun install options.
What happens
- Creates
composer.jsonif there is none. - Adds the package. Without a version, writes
^major.minorof the newest one. - Moves the package if it is already in the other section.
- Updates and installs it, like
pun update. - If anything fails, restores
composer.jsonandcomposer.lock.
Exit codes
| Code | Meaning |
|---|---|
| 0 | Added and installed. |
| 2 | Requirements that clash, or a failed install. |