wp package

Lists, installs, and removes WP-CLI packages.

WP-CLI packages are community-maintained projects built on WP-CLI. They can contain WP-CLI commands, but they can also just extend WP-CLI in some way.

Learn how to create your own command from the Commands Cookbook.

Subcommands

Command Description
wp package browse Browses WP-CLI packages available for installation.
wp package install Installs a WP-CLI package.
wp package list Lists installed WP-CLI packages.
wp package path Gets the path to an installed WP-CLI package, or the package directory.
wp package uninstall Uninstalls a WP-CLI package.
wp package update Updates all installed WP-CLI packages to their latest version.

wp package browse

Browses WP-CLI packages available for installation.

Lists packages available for installation from the Package Index.

Note: The package index has been deprecated and will not be updated further. See https://github.com/wp-cli/ideas/issues/51 for information about its potential replacement.

Synopsis

wp package browse [--fields=<fields>] [--format=<format>]

Options

[--fields=<fields>]
: Limit the output to specific fields. Defaults to all fields.

[--format=<format>]
: Render output in a particular format (table, csv, ids, json, yaml).

Available Fields

  • name
  • description
  • authors
  • version

Examples

$ wp package browse --format=yaml
---
10up/mu-migration:
  name: 10up/mu-migration
  description: A set of WP-CLI commands to support the migration of single WordPress instances to multisite
  authors: Nícholas André
  version: dev-main, dev-develop

wp package install

Installs a WP-CLI package.

Packages are required to be a valid Composer package, and can be specified as:

  • Package name from WP-CLI’s package index.
  • Git URL accessible by the current shell user.
  • Path to a directory on the local machine.
  • Local or remote .zip file.

Packages are installed to ~/.wp-cli/packages/ by default. Use the WP_CLI_PACKAGES_DIR environment variable to provide a custom path.

Synopsis

wp package install <name|git|path|zip> [--insecure]

Options

<name|git|path|zip>
: Name, git URL, directory path, or .zip file for the package to install. Names can optionally include a version constraint (e.g. wp-cli/server-command:@stable).

[--insecure]
: Retry downloads without certificate validation if TLS handshake fails.

Examples

# Install a package hosted at a git URL.
$ wp package install runcommand/hook

# Install the latest stable version.
$ wp package install wp-cli/server-command:@stable

# Install a package hosted at a GitLab.com URL.
$ wp package install https://gitlab.com/foo/wp-cli-bar-command.git

# Install a package in a .zip file.
$ wp package install google-sitemap-generator-cli.zip

wp package list

Lists installed WP-CLI packages.

Synopsis

wp package list [--fields=<fields>] [--format=<format>]

Options

[--fields=<fields>]
: Limit the output to specific fields. Defaults to all fields.

[--format=<format>]
: Render output in a particular format (table, csv, ids, json, yaml).

Available Fields

Default: name, authors, version, update, update_version

Optional: description

Examples

$ wp package list
+-----------------------+------------------+----------+-----------+----------------+
| name                  | authors          | version  | update    | update_version |
+-----------------------+------------------+----------+-----------+----------------+
| wp-cli/server-command | Daniel Bachhuber | dev-main | available | 2.x-dev        |
+-----------------------+------------------+----------+-----------+----------------+

wp package path

Gets the path to an installed WP-CLI package, or the package directory.

Synopsis

wp package path [<name>]

Options

[<name>]
: Name of the package to get the directory for.

Examples

# Get package path.
$ wp package path
/home/person/.wp-cli/packages/

# Get path to an installed package.
$ wp package path wp-cli/server-command
/home/person/.wp-cli/packages/vendor/wp-cli/server-command

# Change directory to package path.
$ cd $(wp package path) && pwd
/home/vagrant/.wp-cli/packages

wp package uninstall

Uninstalls a WP-CLI package.

Synopsis

wp package uninstall <name> [--insecure]

Options

<name>
: Name of the package to uninstall.

[--insecure]
: Retry downloads without certificate validation if TLS handshake fails.

Examples

$ wp package uninstall wp-cli/server-command
Removing require statement for package 'wp-cli/server-command' from /home/person/.wp-cli/packages/composer.json
Removing repository details from /home/person/.wp-cli/packages/composer.json
Removing package directories and regenerating autoloader...
Success: Uninstalled package.

wp package update

Updates all installed WP-CLI packages to their latest version.

Synopsis

wp package update

Examples

$ wp package update
Using Composer to update packages...
---
Loading composer repositories with package information
Updating dependencies
Resolving dependencies through SAT
Dependency resolution completed in 0.074 seconds
Analyzed 1062 packages to resolve dependencies
Analyzed 22383 rules to resolve dependencies
Writing lock file
Generating autoload files
---
Success: Packages updated.