viv x

Installs (if needed) and runs a package's bin in an isolated, content-hashed environment, npx-style. Handy for a one-off tool like PHPUnit or PHP CS Fixer, without touching your project's composer.json or vendor/.

Usage

Install (if needed) and run a package's bin in an isolated, content-hashed env, npx-style (#85)

Usage: viv x [OPTIONS] [COMMAND]...

Arguments:
  [COMMAND]...  `vendor/package` or `vendor/package:constraint`, followed by arguments passed through to the executed bin; omit with `--list` or `--uninstall`. viv's own flags (`--bin`, `--refresh`, `-d`, `--cache-dir`, `-v`, `--offline`) only apply before the package name — `viv x phpunit/phpunit --filter Foo` passes `--filter Foo` to `phpunit`, not to `viv`

Options:
      --bin <BIN>              Which bin to exec, when the package ships more than one
  -v, --verbose                Raise logging to debug
      --cache-dir <CACHE_DIR>  Store location (default `$XDG_CACHE_HOME/vivace`, or `~/.cache/vivace`)
      --refresh                Re-resolve and reinstall even if this constraint is already cached
      --list                   List every package cached by a previous `viv x` run
      --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)
      --uninstall <UNINSTALL>  Remove a cached tool env (every constraint cached for it)
  -h, --help                   Print help

Reads and writes

  • Reads: the store under $XDG_CACHE_HOME/vivace for an already-built env matching the same content hash, and the current directory's composer.json for a config.platform.php pin. With a pin, the tool resolves against that PHP instead of the one on PATH.
  • Writes: the store's tools-v0 bucket (a fresh synthetic-root env, when none matches yet), and its php-v0 bucket when the pinned PHP isn't installed yet (not with --offline).

Exit codes

  • 0 — the tool ran and exited 0.
  • non-zero — the tool's own exit code, passed straight through; 1 if viv itself failed to build or resolve the environment.

See also

viv run, viv exec