Composer has become the standard dependency manager in the PHP ecosystem. While originally designed for managing libraries and frameworks, it also works perfectly for handling WordPress itself and its plugins. With Composer, you can maintain consistent environments, automate deployments, and keep your dependencies under control – including both free and premium WordPress plugins.
In this guide, you’ll learn how to use Composer in WordPress projects, how to add free plugins like WooCommerce and Flexible Shipping, and how to manage premium Octolize plugins such as Flexible Shipping PRO from the dedicated Composer repository.
What is Composer?
Composer is a dependency manager for PHP. Instead of manually downloading packages and placing them in your project, you can declare the dependencies in a composer.json
file, and Composer will install and update them for you.
- Installing and updating WordPress core.
- Adding and updating plugins and themes.
- Managing premium plugins with API keys.
This makes your project reproducible and easier to maintain, especially in teams or CI/CD pipelines.
Using Composer in WordPress Projects
To use Composer in a WordPress project, you’ll need a starter project. One of the most popular is Bedrock by Roots.
Step-by-step with Bedrock
1. Create a new Bedrock project
composer create-project roots/bedrock your-project
2. Navigate to your project directory
cd your-project
3. Configure your environment
Bedrock uses environment variables stored in .env
to configure your WordPress installation (database, URLs, keys, etc.).
4. Run the initial installation
composer install
Your project is now set up with WordPress managed by Composer.
Adding Free WordPress Plugins with Composer
Free plugins are available from WordPress.org and can be managed with Composer using wpackagist.org, which mirrors all plugins from the official repository.
For example, to add WooCommerce and Flexible Shipping:
composer require wpackagist-plugin/woocommerce
composer require wpackagist-plugin/flexible-shipping
These plugins will be downloaded into your vendor
folder and linked into WordPress (via Bedrock’s structure).
By committing your composer.json
and composer.lock
files, your entire team will always install the exact same versions.
Adding Premium Octolize Plugins with Composer
While free plugins like Flexible Shipping are on WordPress.org, premium versions such as Flexible Shipping PRO are distributed through Octolize’s Composer repository:
Repository URL: https://composer.octolize.dev
Access is secured with an API key, available only to active subscribers. You can find your key in your Octolize account.
Step-by-step installation
1. Configure the Octolize repository in composer.json
{
"repositories": [
{
"type": "composer",
"url": "https://composer.octolize.dev",
"only": ["octolize-plugin/*"]
}
]
}
2. Authenticate with your API key
Use Composer’s built-in authentication mechanism:
composer config --global --auth bearer.octolize-plugin "your_api_key_here"
Replace "your_api_key_here"
with the API key from your Octolize account. Only active subscriptions provide valid API keys.
3. Require the premium plugin
composer require octolize-plugin/flexible-shipping-pro
Composer will download the plugin from Octolize’s repository and install it in your WordPress project.
Summary
Using Composer in WordPress projects provides a reliable and modern way of managing both free and premium plugins.
- Free plugins such as WooCommerce and Flexible Shipping can be installed via WPackagist.
- Premium Octolize plugins like Flexible Shipping PRO can be securely installed using the Composer repository at composer.octolize.dev, authenticated with an API key.
This setup ensures your WordPress environment is consistent, reproducible, and easy to maintain.