Skip to content

Commit 95c8ad6

Browse files
authored
Merge pull request #587 from wp-cli/copilot/add-documentation-version-constraints
2 parents 8f11176 + 3ce9359 commit 95c8ad6

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

guides.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
* **[External resources](https://make.wordpress.org/cli/handbook/guides/external-resources/)** - Blog posts, slides and videos from users.
1010
* **[Force output to a specific locale](https://make.wordpress.org/cli/handbook/guides/force-output-specific-locale/)** - Localisation issue
1111
* **[Identify a Plugin or Theme Conflict](https://make.wordpress.org/cli/handbook/guides/identify-plugin-theme-conflict/)** - Debugging advise
12+
* **[Installing WP-CLI Packages](https://make.wordpress.org/cli/handbook/guides/installing-packages/)** - Learn how to install packages and use version constraints
1213
* **[Sharing WP-CLI Packages](https://make.wordpress.org/cli/handbook/guides/sharing-wp-cli-packages/)** - Some words about your environment
1314
* **[Troubleshooting Guide](https://make.wordpress.org/cli/handbook/guides/troubleshooting/)** - Some help to troubleshoot

guides/installing-packages.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Installing WP-CLI Packages
2+
3+
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.
4+
5+
To find existing packages to install, take a look at [Packagist](https://packagist.org/?type=wp-cli-package).
6+
7+
## Installing a Package
8+
9+
Use the `wp package install` command to install a package. Packages can be specified as:
10+
11+
* Package name from WP-CLI's package index
12+
* Git URL accessible by the current shell user
13+
* Path to a directory on the local machine
14+
* Local or remote .zip file
15+
16+
```bash
17+
# Install a package by name
18+
wp package install wp-cli/server-command
19+
20+
# Install from a Git URL
21+
wp package install https://github.com/wp-cli/server-command.git
22+
23+
# Install from a local directory
24+
wp package install /path/to/package
25+
26+
# Install from a .zip file
27+
wp package install package.zip
28+
```
29+
30+
Packages are installed to `~/.wp-cli/packages/` by default. Use the `WP_CLI_PACKAGES_DIR` environment variable to provide a custom path. See also: [Sharing WP-CLI Packages](https://make.wordpress.org/cli/handbook/guides/sharing-wp-cli-packages/).
31+
32+
## Version Constraints
33+
34+
When installing WP-CLI packages, you can specify version constraints to control which version of a package is installed.
35+
36+
Version constraints are specified by appending a colon (`:`) followed by the constraint to the package name:
37+
38+
```bash
39+
wp package install <package-name>:<version-constraint>
40+
```
41+
42+
WP-CLI uses Composer's version constraint syntax. Here are some commonly used examples:
43+
44+
```bash
45+
# Install a specific version
46+
wp package install wp-cli/server-command:2.0.0
47+
48+
# Install with caret operator (allows non-breaking updates)
49+
wp package install wp-cli/server-command:^1.0
50+
51+
# Install with tilde operator (allows patch-level updates)
52+
wp package install wp-cli/server-command:~1.2
53+
54+
# Install the latest stable release
55+
wp package install wp-cli/server-command:@stable
56+
57+
# Install from a development branch
58+
wp package install wp-cli/server-command:dev-main
59+
```
60+
61+
For complete documentation on version constraint syntax and operators, see the [Composer documentation on versions and constraints](https://getcomposer.org/doc/articles/versions.md).

references/tools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Tools
22

3-
The following is a list of projects that integrate with WP-CLI in some form. For installable WP-CLI packages, please see the [package index](https://wp-cli.org/package-index/).
3+
The following is a list of projects that integrate with WP-CLI in some form. For installable WP-CLI packages, take a look at [Packagist](https://packagist.org/?type=wp-cli-package).
44

55
## Plugins
66

0 commit comments

Comments
 (0)