viv add

Edits composer.json to add a dependency, resolves it and installs it, in one step. --no-install/--no-update opt out of the install or the resolve.

Usage

Add a dependency to composer.json, resolve it and install (`--no-install`/`--no-update` opt out)

Usage: viv add [OPTIONS] <PACKAGES>...

Arguments:
  <PACKAGES>...  `vendor/package` or `vendor/package:constraint`; a bare name gets a synthesised constraint (`VersionSelector::findRecommendedRequireVersion`)

Options:
      --dev                          Add to `require-dev` instead of `require`
  -v, --verbose                      Raise logging to debug
      --cache-dir <CACHE_DIR>        Store location (default `$XDG_CACHE_HOME/vivace`, or `~/.cache/vivace`)
      --no-update                    Edit `composer.json` only; don't resolve, touch `composer.lock`, or install (implies `--no-install`, matching `composer require`)
      --offline                      Fail fast on any request instead of connecting: install errors, naming every package not already in the store; update solves from cached repository metadata only, erroring on an uncached package. Also set by `COMPOSER_DISABLE_NETWORK` (any value but unset, empty or `0`; Composer's own git-priming `prime` value is not special-cased here, since neither `install` nor `update` touch a git source)
      --sort-packages                Sort the touched require section alphabetically (platform packages first), even if `config.sort-packages` is not set
      --prefer-lowest                Prefer the lowest package versions that satisfy every constraint
      --prefer-stable                Prefer stable releases for the synthesised constraint and the partial update alike
      --no-normalize                 Deprecated, no-op (#145): `add` always normalizes `composer.json` now, same as `install`/`dump-autoload` since 0.6
  -d, --project-dir <PROJECT_DIR>    Project directory holding `composer.json` [default: .]
      --no-scripts                   Skip `pre-update-cmd`/`post-update-cmd` and every other root `scripts` listener, including the chained install's own `pre-autoload-dump`/`post-autoload-dump`
      --no-plugins                   Passed straight through to the chained install (`docs/plugin-strategy.md`)
      --no-install                   Skip the install step after writing `composer.lock` (`composer require --no-install`): today's `viv add` behaviour
      --ignore-platform-reqs         Ignore every platform (`php`/`ext-*`/`lib-*`) requirement in the partial update's solve and in the chained install's platform check, as Composer's flag does (#242)
      --ignore-platform-req <REQ>    Ignore one named platform requirement (`*` glob, repeatable) in the solve and in the chained install's platform check (#242)
      --no-blocking                  Allows installing a version a known security advisory covers or a package Packagist marks abandoned, instead of blocking it by default (#175, `audit.block-insecure`/`audit.block-abandoned`). Also settable via `COMPOSER_NO_SECURITY_BLOCKING=1`
      --metadata-ttl <METADATA_TTL>  Seconds a cached `/p2/` provider file may be served without revalidating it (#191). `0` (the default) always revalidates, matching today's behaviour. Also settable via `VIV_METADATA_TTL` (this flag wins); `--offline` always wins over either
      --repository <TYPE:URL>        `type:url`, repeatable; appended to `repositories` (#315), e.g. `--repository path:packages/*`
  -h, --help                         Print help

Reads and writes

  • Reads: composer.json, composer.lock, the store under $XDG_CACHE_HOME/vivace.
  • Writes: composer.json, composer.lock, and, unless --no-install, vendor/ and the store.

Exit codes

  • 0 — added, resolved and installed cleanly.
  • 1 — a filesystem, network, or archive error; a bad flag.
  • 2 — the solver found no solution for the new requirement.

See also

viv rm, viv update