Optimized Drupal 8 development environment
This tutorial is mainly aimed at Drupal developers who use Windows 7. If you're using Windows 10 you can use the Linux bash shell.
We will be using Acquia Dev Desktop, created by Acquia, which is a full-Drupal stack specifically made for Drupal web development. It comes with Drush and XAMP, which includes Apache, MySQL, and PHP. Further we will use Git Bash to install Composer and Drupal Console to generate boilerplate code and interact with Drupal 8 installations.
First of all we will start with installing Acquia Dev Desktop. Since I have no XAMPP or WAMP installed, I'm using default ports 80 & 443. Also to avoid having urls with custom ports (http://test.dd:8083)
Next, install GIT for windows with Git Bash. For most installations, the defaults during installation should suffice, but check what fits best for you.
Add environment variables:
Right click "Computer" > Properties > Advanced system settings > Environment variables...
Make sure the following folders are in the Path variable:
C:\Program Files (x86)\DevDesktop\php7_0;C:\Program Files (x86)\DevDesktop\tools
Now we will create executable files for Git Bash. This way you can run "drush" and "composer" without having to add the .bat extension in Git bash.
In your Dev Desktop installation folder, there is a folder called tools (C:\Program Files (x86)\DevDesktop\tools), create the following files in this folder: "drush" & "composer" (no extension) and add the following to these files:
#!/bin/sh cmd //c "$0.bat" "$@"
Next we're going to replace the original composer.bat by something we can call from anywhere.
Go to C:\Program Files (x86)\DevDesktop\tools and rename composer.bat to something like this: composer_original.bat
Create a new composer.bat file and enter the following content:
@php "%~dp0composer.phar" %*
Please bear in mind that these changes can be overridden when you update Dev Desktop.
Use Git Bash or Windows CMD and go to C:\Program Files (x86)\DevDesktop\tools
Execute the following commands:
(if this doesn't work use "php composer.phar install")
In Git Bash home directory ~/ execute:
cd ~ composer self-update
Next up is installing Drupal Console:
composer global require drupal/console:@stable
This command will make make drupal console globally available.
Next we'll add C:\Users\_x_\AppData\Roaming\Composer\vendor\bin to our Path variable.
Now, add or create a Drupal 8 website in Acquia Dev Desktop and complete the installation at /install.php
It's time to test if Drupal Console is working.
Open C:\Users\_x_\Sites\devdesktop\test in Git Bash and execute:
Hopefully this tutorial was helpful in setting up your development environment for Drupal 8.