# Installing wp-env

wp-env is pretty nice and the .wp-env.json file makes me think it's most of the way there as a generic local wp setup. of course it doesn't have redis / composer / support for multiple php versions, caching plugins, and dev tools installed with it.

## Requirements

Requires [nvm](https://github.com/nvm-sh/nvm#installing-and-updating) and [docker](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository).

## Installation
First install `docker-compose` (this script doesn't work with `docker compose`):
```shell
# On Debian or derivatives
$ sudo apt install docker-compose -y
```

Then install wp-env

```shell
# Install and use the latest LTS node
$ nvm install --lts
$ nvm use lts/*

# Install wp-env as a global node LTS package
$ npm install --global @wordpress/env
```

## Usage

Now it's ready:

```shell
$ cd ~/path/to/myplugin

# Now you can use it anytime
$ wp-env start
WordPress development site started at http://localhost:8888/
WordPress test site started at http://localhost:8889/
MySQL is listening on port 32773
MySQL for automated testing is listening on port 32772

$ wp-env stop
✔ Stopped WordPress. (in 3s 165ms)`
```

The information is based on the [official wp-env announcement](https://make.wordpress.org/core/2020/03/03/wp-env-simple-local-environments-for-wordpress/)