# How to install a new WordPress site from scratch using WP-CLI.
# We are going to assume that you have installed WP-CLI with all of the needed dependencies (composer, mysql, php) and added them to the global system/user path.

# Commands that you need to use in the CLI are marked with a ">" at the start of the row (you don't need to add that to the command).


# Create a new empty directory in your /www path. You can do that from the CLI directly. We are going to do a local install using WAMP software stack.
# Either go to the /www directory through explorer and create a new folder or use the following command in the CLI (you have to change your current directory to '/wamp/www' first).

> mkdir wordpress

# Change the current directory to the newly created one.

> cd wordpress

# Use WP-CLI to download the WordPress core.

> wp core download
Downloading WordPress 4.5.2 (en_US)...
Success: WordPress downloaded.

# Next, you have to create the wp-config.php file.

> wp core config --prompt

# This will prompt you for the parameters needed to setup the file.
# You have to fill in only the first two parameters for a local install (assuming the root password is blank - the default WAMP uses for MySQL).
# You can skip the next 9 prompts for the local install.

1/11 --dbname=<dbname>: wordpress
2/11 --dbuser=<dbuser>: root
3/11 [--dbpass=<dbpass>]:
4/11 [--dbhost=<dbhost>]:
5/11 [--dbprefix=<dbprefix>]:
6/11 [--dbcharset=<dbcharset>]:
7/11 [--dbcollate=<dbcollate>]:
8/11 [--locale=<locale>]:
9/11 [--extra-php] (Y/n):
10/11 [--skip-salts] (Y/n):
11/11 [--skip-check] (Y/n):
Success: Generated wp-config.php file.

# Next, we need to create the database for the local WordPress install. This will create a database named wordpress. Based on the name you gave it at the previous step.

> wp db create
Success: Database created.

# Now we'll install WordPress locally. You'll have to fill in the details for the installation.

> wp core install --prompt

# The CLI will prompt you for the next parameters needed to setup the WordPress site.

1/6 --url=<url>: localhost/wordpress
2/6 --title=<site-title>: test
3/6 --admin_user=<username>: admin
4/6 --admin_password=<password>: admin
5/6 --admin_email=<email>: admin@example.com
6/6 [--skip-email] (Y/n): Y
Success: WordPress installed successfully.

That's it! You now have a clean wordpress site named test and you can access it from the browser at 'localhost/wordpress'.