👩‍🔧 Installing WordPress through Composer and WP-CLI

— 1 minute read

Some time ago, I wrote article Using Composer With WordPres for Smashing Magazine to describe how to integrate WordPress and Composer together, with the aim to install WordPress more easily than through the official, manual way. One of my observations was that the installation process through Composer was a bit fragmented, since we still had to edit file wp-config.php, install the WordPress database and manually change the site URL in wp-admin. One reader asked, through a comment, if it was possible to also automate this step through WP-CLI, the command-line interface for WordPress, and I was not so sure about it, since I had never tried.

Well, now I have tried, and I can say: Yes, it is possible. Moreover, to prove it, I have created a Composer project executing the missing extra steps through WP-CLI, and it works like a charm! Now, I can simply execute a simple command, and my WordPress instance will be installed in a matter of minutes, without any further intervention. I put all the code in this GitHub repo: Install WordPress through Composer and WP-CLI.

If you need to quickly install WordPress, try out this project and let me know how it went. Enjoy!