Install with Composer
Install UnleashWP plugins and themes with Composer from composer.unleash-wp.com, keep the license key out of Git and activate it from wp-config.php.
Every licensed UnleashWP plugin and theme is also available as a Composer package. If your sites are built and deployed with Composer, you can pull our products in the same way as everything else, with your license key as the only credential.
What Composer is
Composer is the package manager for PHP. You list the plugins and themes a site needs in a file called composer.json, run one command, and Composer downloads exactly those versions into the right folders. It also writes a composer.lock file that pins every version, so your laptop, your staging server and your live server all end up with the same code.
Before you start
- Composer 2 installed on your computer or build server (
composer --version). - A WordPress project that already has a
composer.json, for example a Bedrock project or your own setup. - An active UnleashWP license. You find it in your account under Licenses.
Quick start
Open the Composer dialog
Sign in to your account, open Downloads and click Composer below the product's Download button. The dialog Install with Composer shows every line below with your license key and the current version already filled in.
Save your key for Composer
Run the Command from the dialog once on your computer. Composer remembers your key and sends it only to composer.unleash-wp.com.
Add the repository and the package
Copy the composer.json lines from the dialog into your project's composer.json.
Install
Run composer update unleashwp/easy-svg-pro (with your product's name). The plugin lands in wp-content/plugins.
Activate the license
Add the wp-config.php line from the dialog and set the key on the server. The site activates itself the next time an administrator opens wp-admin.
Step by step
1. Tell Composer your license key
Your license key is the password. The user name is not checked, the account uses unleashwp. Pick one of these ways:
Run this once. It stores the key in Composer's global auth.json in your home folder, outside every project:
composer config --global --auth http-basic.composer.unleash-wp.com unleashwp YOUR_LICENSE_KEY
Put a file named auth.json next to composer.json. The dialog has a Download auth.json button that gives you this file:
{
"http-basic": {
"composer.unleash-wp.com": {
"username": "unleashwp",
"password": "YOUR_LICENSE_KEY"
}
}
}
Add it to .gitignore straight away:
echo "auth.json" >> .gitignore
On a build server, put the same JSON into the COMPOSER_AUTH environment variable. Composer reads it automatically. See Use it in CI below.
auth.json or paste your license key into composer.json. Both files are shared with everyone who can read the repository, and your key opens your downloads.2. Add the repository and the package
Add our repository and require the package in your project's composer.json:
{
"repositories": [
{ "type": "composer", "url": "https://composer.unleash-wp.com" }
],
"require": {
"unleashwp/easy-svg-pro": "^1.0"
},
"config": {
"allow-plugins": {
"composer/installers": true
}
}
}
- Every package is named
unleashwp/followed by the product's slug, for exampleunleashwp/easy-svg-pro. The dialog in your account shows the exact name and a version constraint for the current release. - Our packages depend on
composer/installers, which moves plugins and themes into the WordPress folders. Composer 2.2 and newer asks before it runs such a plugin. Theallow-pluginsentry answers that question in advance, which matters on a build server where nobody can type "yes".
Then install:
composer update unleashwp/easy-svg-pro
3. Where the files go
composer/installers reads the package type:
| Package type | Default folder |
|---|---|
wordpress-plugin | wp-content/plugins/SLUG/ |
wordpress-theme | wp-content/themes/SLUG/ |
If your WordPress lives somewhere else, set installer-paths. In a Bedrock project this is already done:
{
"extra": {
"installer-paths": {
"web/app/plugins/{$name}/": ["type:wordpress-plugin"],
"web/app/themes/{$name}/": ["type:wordpress-theme"]
}
}
}
4. Activate the license from wp-config.php
Composer only brings the files. The license is activated by a constant in wp-config.php. Read the key from the server environment, so it is not in Git either:
define( 'EASY_SVG_PRO_LICENSE_KEY', getenv( 'EASY_SVG_PRO_LICENSE_KEY' ) );
Then set EASY_SVG_PRO_LICENSE_KEY on the server, in your hosting panel, your .env file or your deployment tool. The next time an administrator opens wp-admin, the site activates itself and uses one seat of your license. More on this in Activate a license key and Deploy with Git and CI.
Updating
composer update unleashwp/easy-svg-pro
This fetches the newest version your constraint allows and writes it into composer.lock. Commit composer.lock. Every later composer install, on any machine, then installs exactly the version in that file, which keeps staging and live identical.
With an active license, WordPress also offers updates under Dashboard → Updates. On a Composer site you usually want Composer to be the only source, so that the files on the server always match composer.lock. Turn off updates from wp-admin with:
define( 'DISALLOW_FILE_MODS', true );
composer.lock do not expire. Your key is checked again on every download instead, so composer install from an old lock file keeps working as long as the license is active.Use it in CI
On a build server, give Composer the key through the COMPOSER_AUTH environment variable instead of a file. Store the key as a secret in your CI system, never in the repository.
Create a repository secret named UNLEASHWP_LICENSE_KEY, then:
- name: Install PHP dependencies
env:
COMPOSER_AUTH: '{"http-basic":{"composer.unleash-wp.com":{"username":"unleashwp","password":"${{ secrets.UNLEASHWP_LICENSE_KEY }}"}}}'
run: composer install --no-dev --no-interaction --prefer-dist
export COMPOSER_AUTH='{"http-basic":{"composer.unleash-wp.com":{"username":"unleashwp","password":"YOUR_LICENSE_KEY"}}}'
composer install --no-dev --no-interaction --prefer-dist
Replace YOUR_LICENSE_KEY with your CI system's secret variable.
One license per project
Composer can store only one password per host. Since your license key is that password, one project uses one license key for everything it installs from composer.unleash-wp.com.
- The key lists only the products that license includes. Two products bought as separate licenses cannot both be installed through Composer in the same project with one key.
- Installing with Composer does not use a seat. A seat is used when a site activates itself from the
wp-config.phpconstant, see Licenses. - For agencies: use the license you bought for that client's project, so each project only ever holds its own key.
Troubleshooting
| What you see | What it means | What to do |
|---|---|---|
Composer asks for a user name and password, or 401 with missing_license_key | No key was sent for composer.unleash-wp.com | Run the command from step 1 again, check that auth.json uses exactly composer.unleash-wp.com as the host, or set COMPOSER_AUTH in CI. |
403 with license_not_active | The key is not active: expired, cancelled, refunded or mistyped | Check the license under Licenses in your account and copy the key again. |
403 with not_entitled | The key does not include this package | Use the key of the license you bought this product with. |
could not be found in any version | The package is not part of what this key opens, or the repository entry is missing | Check the repositories entry, the package name (unleashwp/ plus slug) and that the key belongs to this product. |
503 with license_service_unavailable | The license server could not be asked right now | Wait a moment and run Composer again. Nothing is wrong with your license. |
composer/installers contains a Composer plugin which is blocked | Composer 2.2+ wants permission for the installer | Add the allow-plugins entry from step 2. |
| Plugin installed but shown as not activated | The constant is empty on the server | Check that the environment variable is set where PHP runs, then open wp-admin as an administrator. |
Security notes
- Your key travels only in the request header to
composer.unleash-wp.com, never in a URL. - Keep
auth.jsonout of Git. Prefer the global command on your computer andCOMPOSER_AUTHon build servers. - Do not put the key into
composer.json,composer.lock, Dockerfiles or build logs. - If a key was exposed, contact support right away.