2

I want to install WordPress and WP CLI both with Composer.

This is how I install Drupal and Drush (Drupal's CLI tool) with Composer:

cd WEB_APPLICATION_ROOT
composer create-project drupal/recommended-project WEB_APPLICATION_DIR_NAME
cd WEB_APPLICATION_DIR_NAME
composer require drush/drush
vendor/bin/drush site:install

Is there a similar way to install for WordPress?

4
  • 4
    there is no canonical install method for WordPress using composer, there are multiple widely used unofficial methods, and there is no official golden path. There's also a fundamental difference between what you're hoping for and how WordPress works, your example creates a project out of Drupal which becomes your codebase, which is not how WordPress installs work. Rather WordPress would be a dependency of your project that you then update on a regular basis, not the starting point
    – Tom J Nowell
    Oct 20, 2022 at 11:00
  • I once created github.com/leymannx/wordpress-project following the Drupal template, to make WordPress follow the same logic. Haven't touched it in over four years, still runs successfully in production. It works with symlinks to overcome the WordPress monorepo.
    – leymannx
    Oct 20, 2022 at 11:25
  • 1
    Most people probably use Bedrock, but you have to get used to it. There's also github.com/wodby/wordpress-composer.
    – leymannx
    Oct 20, 2022 at 11:28
  • 1
    There's also WPStarter, wecodemore.github.io/wpstarter, by @gmazzap Oct 20, 2022 at 13:52

1 Answer 1

0

Using roots Bedrock for a few years, I gladly recommend it. Core versions are all available and are synced by roots.io technical team.

Using WordPress with composer would allow you to have dependencies (WP core, plugins, themes, and other PHP libs) all managed with composer versions. Bedrock will also ensure that no core file is edited as they are stored as a vendor.

Automatic deployment process are done just like with every other PHP application.

The downside of it, is that you won't benefit automatic updates for your app and you will have to handle them yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.