Even for the smallest WordPress development project you need a local environment to build, run and test the code every time. There are already many very good tools for this. With wp-env you can start an IDE immediately with zero configuration in ‘nullkommanix’.
wp-env is an npm package developed by the Gutenberg project. It is a command-line tool that sets up a Docker based WordPress environment on your computer.
I will show you the easy-peasy way:
The only prerequisites you need is Node.js and Docker on your computer.
Install wp-env global then you can use it everywhere. Just open your terminal and enter:
npm -g i @wordpress/env
Start Docker and go in your terminal to the root folder of your plugin or theme and start wp-env:
This will start a new instance of Docker and – if necessary – download the latest version of WordPress.
Once the download is complete, you can navigate to http://localhost:8888/ in your web browser to access your new local WordPress site.
This is really easy-peasy isn’t it?
Of course you can have for the IDE an little bit more advanced setup. Just add an an .wp-env.json file in your project root and set the configurations. You will find an detailed overview of all the setup options in the wp-env documentation:
But with an advanced setup that is in my eyes no longer the easy-peasy way. 😉