This comprehensive guide explains how to install premium plugins via Composer. In this example, we will cover the installation process for three premium plugins: ACF PRO, Elementor, and Object Cache Pro.
Installing premium plugins via Composer offers several benefits, which include:
Automation and Version Control: Composer simplifies the process of managing dependencies by automating the installation, updating, and removal of plugins. This ensures that you are using the correct version of each plugin, reducing compatibility issues and potential conflicts with other WordPress components.
Consistency Across Environments: Composer installations are consistent across development, staging, and production environments. This consistency minimizes the risk of errors that may arise from manually uploading files or using different installation methods in various environments.
Security: Authentication and private repositories provide a secure way to access premium plugins. Your credentials are stored securely, and you have control over access, reducing the risk of unauthorized use.
Ease of Deployment: When using Composer, deploying your WordPress site to a new server or environment becomes straightforward. You can replicate your setup by running composer install
, which downloads all required plugins, making the deployment process faster and more reliable.
Centralized Management: All your plugins, including premium ones, are managed through Composer, making it easier to keep your WordPress site up to date with the latest versions. You can update all dependencies with a single command.
Before installing premium plugins, it’s essential to set up authentication in your Composer configuration. This ensures that you have the necessary credentials to access the plugin repositories. Here’s how to do it:
1. Create or Edit auth.json
You should have an auth.json
file in your Composer global configuration directory. If it doesn’t exist, create it. Add the authentication details for ACF PRO, Elementor, and Object Cache Pro as shown below:
{
"http-basic": {
"connect.advancedcustomfields.com": {
"username": "Dvl2P9fLovYy2oJkdYOPiCrHXcRgGrmk9WR62HdErPasPsV43COx0anwTizc9XFrY8qysqqZ",
"password": "https://mysite.com"
},
"composer.elementor.com": {
"username": "token",
"password": "<elementor-license-key>"
},
"objectcache.pro": {
"username": "token",
"password": "<object-cache-license-key>"
}
}
}
Replace <elementor-license-key>
and <object-cache-license-key>
with your actual Elementor and Object Cache Pro license keys.
Alternatively, you can set authentication through the COMPOSER_AUTH
environment variable for added flexibility.
Next, add the repositories for the premium plugins to your composer.json
file. This tells Composer where to find the plugins. Here’s how to do it:
1. Edit composer.json
In your project’s composer.json
file, add the repositories for ACF PRO, Elementor, and Object Cache Pro as follows:
{
"repositories": [
{
"type": "composer",
"url": "https://composer.elementor.com",
"only": [
"elementor/elementor-pro"
]
},
{
"type": "composer",
"url": "https://connect.advancedcustomfields.com"
},
{
"type": "composer",
"url": "https://objectcache.pro/repo/"
}
]
}
With authentication and repositories set up, you can now install the premium plugins using Composer. For example, to install ACF PRO, Elementor, and Object Cache Pro, run the following commands:
For ACF PRO:
composer require wpengine/advanced-custom-fields-pro
For Elementor:
composer require elementor/elementor-pro
For Object Cache Pro:
composer require rhubarbgroup/object-cache-pro
For more detailed installation instructions and resources for these premium plugins, please visit their respective websites: