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

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.json if there is none.
  • Adds the package. Without a version, writes ^major.minor of 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.json and composer.lock.

Exit codes

Code Meaning
0 Added and installed.
2 Requirements that clash, or a failed install.

Last updated on

Was this page helpful?