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.
Installable packages are listed in the Package Index.
Learn how to create your own command from the Commands Cookbook.
Commands | 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 update | Updates all installed WP-CLI packages to their latest version. |
wp package uninstall | Uninstalls a WP-CLI package. |
Examples
# List installed packages $ wp package list +-----------------------+------------------------------------------+---------+------------+ | name | description | authors | version | +-----------------------+------------------------------------------+---------+------------+ | wp-cli/server-command | Start a development server for WordPress | | dev-master | +-----------------------+------------------------------------------+---------+------------+ # Install the latest development version of the package $ wp package install wp-cli/server-command Installing package wp-cli/server-command (dev-master) Updating /home/person/.wp-cli/packages/composer.json to require the package... Using Composer to install the package... --- Loading composer repositories with package information Updating dependencies Resolving dependencies through SAT Dependency resolution completed in 0.005 seconds Analyzed 732 packages to resolve dependencies Analyzed 1034 rules to resolve dependencies - Installing package Writing lock file Generating autoload files --- Success: Package installed. # Uninstall package $ wp package uninstall wp-cli/server-command Removing require statement from /home/person/.wp-cli/packages/composer.json Deleting package directory /home/person/.wp-cli/packages/vendor/wp-cli/server-command Regenerating Composer autoload. Success: Uninstalled package.
Source code of the commands
wp package browse
Browses WP-CLI packages available for installation.
Lists packages available for installation from the Package Index. Although the package index will remain in place for backward compatibility reasons, it has been deprecated and will not be updated further. Please refer to https://github.com/wp-cli/ideas/issues/51 to read about its potential replacement.
Usage
wp package browse [--fields={fields}] [--format={format}]
You can specify global options and the following:
- [--fields={fields}]
- Limit the output to specific fields. Defaults to all fields.
- [--format={format}]
Render output in a particular format.
Default: table
Can be:- table
- csv
- ids
- json
- yaml
Available fields
These fields will be displayed by default for each package:
- name
- description
- authors
- version
There are no optionally available fields.
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-master, dev-develop aaemnnosttv/wp-cli-dotenv-command: name: aaemnnosttv/wp-cli-dotenv-command description: Dotenv commands for WP-CLI authors: Evan Mattson version: v0.1, v0.1-beta.1, v0.2, dev-master, dev-dev, dev-develop, dev-tests/behat aaemnnosttv/wp-cli-http-command: name: aaemnnosttv/wp-cli-http-command description: WP-CLI command for using the WordPress HTTP API authors: Evan Mattson version: dev-master
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.
When installing a local directory, WP-CLI simply registers a reference to the directory. If you move or delete the directory, WP-CLI's reference breaks.
When installing a .zip file, WP-CLI extracts the package to ~/.wp-cli/packages/local/<package-name>.
Usage
wp package install {name|git|path|zip}
You can specify global options and the following:
- {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).
Examples
# Install the latest development version from the package index. $ wp package install wp-cli/server-command Installing package wp-cli/server-command (dev-master) Updating /home/person/.wp-cli/packages/composer.json to require the package... Using Composer to install the package... Loading composer repositories with package information Updating dependencies Resolving dependencies through SAT Dependency resolution completed in 0.005 seconds Analyzed 732 packages to resolve dependencies Analyzed 1034 rules to resolve dependencies - Installing package Writing lock file Generating autoload files Success: Package installed.
# Install the latest stable version. $ wp package install wp-cli/server-command:@stable
# Install a package hosted at a git URL. $ wp package install [email protected]:runcommand/hook.git
# Install a package in a .zip file. $ wp package install google-sitemap-generator-cli.zip
wp package list
Lists installed WP-CLI packages.
Usage
wp package list [--fields={fields}] [--format={format}]
You can specify global options and the following:
- [--fields={fields}]
- Limit the output to specific fields. Defaults to all fields.
- [--format={format}]
Render output in a particular format.
Default: table
Can be:- table
- csv
- ids
- json
- yaml
Available fields
These fields will be displayed by default for each package:
- name
- authors
- version
- update
- update_version
These fields are optionally available:
- description
Examples
$ wp package list +-----------------------+------------------------------------------+---------+------------+ | name | description | authors | version | +-----------------------+------------------------------------------+---------+------------+ | wp-cli/server-command | Start a development server for WordPress | | dev-master | +-----------------------+------------------------------------------+---------+------------+
wp package path
Gets the path to an installed WP-CLI package, or the package directory.
If you want to contribute to a package, this is a great way to jump to it.
Usage
wp package path [{name}]
You can specify global options and the following:
- [{name}]
- Name of the package to get the directory for.
Examples
# Get package path $ wp package path /home/person/.wp-cli/packages/
# Change directory to package path $ cd $(wp package path) && pwd /home/vagrant/.wp-cli/packages
wp package update
Updates all installed WP-CLI packages to their latest version.
Usage
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.
wp package uninstall
Uninstalls a WP-CLI package.
Usage
wp package uninstall {name}
You can specify global options and the following:
- {name}
- Name of the package to uninstall.
Examples
$ wp package uninstall wp-cli/server-command Removing require statement from /home/person/.wp-cli/packages/composer.json Deleting package directory /home/person/.wp-cli/packages/vendor/wp-cli/server-command Regenerating Composer autoload. Success: Uninstalled package.