Wordpress development workflow
Wordpress development workflow

Streamlining WordPress Project Setup with Composer


As a seasoned Drupal developer with extensive experience in using Composer, I embarked on a journey to explore the world of WordPress project setup through Composer. The allure of harnessing Composer’s capabilities to enhance WordPress projects was too enticing to resist. In this comprehensive guide, we will delve into the intricacies of setting up a WordPress project using Composer, allowing you to leverage the efficiency and flexibility it brings to the table.

The Power of Composer

If you’re familiar with Composer, you already comprehend its prowess in simplifying dependency management through straightforward commands. By adopting Composer, you can judiciously include only the essential code in your repository, preventing the unnecessary clutter of contributed components that can be pulled in as needed.

Navigating the Uncharted Waters

While Composer seamlessly integrates with numerous PHP projects, WordPress doesn’t offer an out-of-the-box solution for Composer-based management. This is where the packages curated by Johnpbloch come to the rescue. They empower you to install WordPress using Composer with remarkable ease by requiring it as a Composer package:

composer require johnpbloch/wordpress:^5.4

For a smoother experience, it is advisable to set “prefer-stable” to true before requiring packages. This will help avoid developmental packages whenever possible.

Exploring the Plugin and Theme Repository

When working with WordPress, plugins and themes are pivotal elements of customization. Fortunately, there’s a dedicated Packagist repository for these essential components, accessible at .To incorporate this repository into your Composer configuration, follow these steps:

"repositories": [
"type": "composer",
"url": "https://wpackagist.org"

With the repository integrated, you can effortlessly require any package you need, such as a popular eCommerce plugin like WooCommerce:

composer require wpackagist-plugin/woocommerce

However, this convenience comes with a caveat. The plugins and themes will initially reside in your project’s root folder, necessitating a relocation to their proper destinations. While the “fancyguy/webroot-installer” package is recommended for this task, I personally encountered difficulties making it function as intended. Instead, I turned to the reliable “composer-symlinks” package, configuring it as follows:

"extra": {
"symlinks": {
"wp-content/plugins": "wordpress/wp-content/plugins",
"wp-content/themes": "wordpress/wp-content/themes"

For reference, you can explore the final “composer.json” file for this setup in the following GitHub repository: link.

A Holistic Approach

In an effort to consolidate the project environment, I integrated my local development tool, Chirripo, into this WordPress project. It ensures that all the necessary components reside within the same repository. Please note that stock Chirripo images lack the mysqli and soap extensions, necessitating manual installation as detailed in the README.md file.

Conclusion: Embracing Efficiency

Thanks to the collaborative efforts of the WordPress community, managing dependencies using Composer has become a feasible and efficient endeavor. The seamless integration of Composer into WordPress projects offers an array of benefits, making it a valuable addition to your toolkit for future WordPress endeavors. Don’t hesitate to embark on this journey and experience the enhanced efficiency and organization it brings to your WordPress projects.

© 2013 - 2024 Foreignerds. All Rights Reserved