Laravel 5 Beauty - Setting up a Windows Machine

How to get your Windows box ready for Laravel 5.1 development

Posted on February 22, 2015 in L5 Beauty
Note this is the second step of the tutorial (for Windows users). Please install everything below before continuing.

This chapter goes through the steps required to set up and install the supporting software for Laravel Homestead on a Windows machine. It is assumed VirtualBox and Vagrant were already installed from the previous chapter.

If you’re using OS X or Linux, please skip to the next chapter.

Chapter Contents

Multiple Ways to Setup Windows

With Windows, there’s quite a few different paths you can go down to install the required software. I tried multiple methods searching for the combination presented below. This chapter has been tested with Windows 8.1 but should work fine with Windows 7.

Step 1 - Installing PHP Natively

The first step is to get PHP running on Windows.

Step 1.1 - Download / Unzip PHP

Go to and download the latest Zip file for your machine. For my machine I downloaded the VC11 x64 Thread Safe version. ( at the time of this writing.)

Unzip this file into the C:\Php directory.

Step 1.2 - Update PHP.INI

Open up a command prompt and do the following to create the php.ini file.

Copy php.ini-development to php.ini

C:\Users\Chuck> cd \php
C:\Php> copy php.ini-development php.ini

Then edit php.ini in a text editor and change the following lines.

Changes in php.ini

// change
; extension_dir = "ext"
// to
extension_dir = "ext"

// change
// to

// change
// to

Now, within the C:\Php directory, you should be able to execute php.

Checking the PHP version

C:\Php> php --version
PHP 5.6.10 (cli) (built: Oct 30 2014 16:05:53)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies

Step 1.3 - Add C:\Php to the path

  • Open up the Windows Control Panel
  • Search for env in the top right corner
  • Click on the Edit environment variables for your account link
  • If PATH is already in your User variables, then [Edit…] it, adding ;C:\Php to your end, otherwise add it.

Figure 3.1 - Adding PHP to Windows Path

Adding PHP to Windows Path

The next time you open up a command prompt, php will be available in your path.

Step 2 - Install Node.js

We’ll install Node.js natively in Windows because later it’ll make it easy to use gulp directly from the Windows command prompt.

Go to and download the Windows Installer for your version of windows. (Either 32-bit or 64-bit.)

Figure 3.2 - Node.js Download Page

Node.js Download Page

Install using defaults. Once installed open up a new command prompt and check the installation by looking at the versions installed.

Checking node and npm versions

C:\Users\Chuck> node --version

C:\Users\Chuck> npm --version

Installing gulp globally

C:\Users\Chuck> npm install -g gulp
C:\Users\Chuck\AppData\Roaming\npm\gulp -> C:\Users\Chuck\AppData/
gulp@3.8.10 C:\Users\Chuck\AppData\Roaming\npm\node_modules\gulp

Checking the gulp version

C:\Users\Chuck> gulp --version
[10:13:44] CLI version 3.8.10

Optionally Install Bower

You can optionally install bower globally if you wish to run bower from a Windows prompt. Personally, I usually run bower within the Homestead Virtual Machine, but it’s whatever your preference is.

Using the Node package manager (NPM), install bower globally.

Installing bower globally

C:\Users\Chuck> npm install -g bower
C:\Users\Chuck\AppData\Roaming\npm\bower -> C:\Users\Chuck\AppData\
bower@1.3.12 C:\Users\Chuck\AppData\Roaming\npm\node_modules\bower

Checking the bower version

C:\Users\Chuck> bower --version

Remember this only installs the programs globally

If you use gulp (or bower) within a particular project you’ll still need to install them locally within that project with a npm install (omitting the -g option). This will be covered later.

Step 3 - Install Composer

Composer is the package manager for PHP.

Figure 3.3 - Composer Home Page

Composer Page

Download and install the Windows setup program, Composer-Setup.exe. Use the defaults when installing and if it asks you the path to PHP, enter C:\Php\php.exe.

Once Composer installs, close any command prompts and open up a new one. Check the version of composer to see if installed correctly.

Checking the Composer version

C:\Users\Chuck> composer --version
Composer version 1.0-dev (b23a3cd36870ff0eefc161a4638d9fcf49d998ba)\
2014-11-21 17:59:11

Installing Composer Updates Your Path

The installation will move C:\Php from your personal path and add it to the system path. It will also add C:\ProgramData\ComposerSetup\bin to your system path.

Step 4 - Install GIT and set up SSH Key

For Windows we’ll install the native GIT application and use GIT BASH only for setting up the SSH Key. Any other GIT usage in Windows will be through the Windows command prompt.

Step 4.1 - Download the git installer

Go to and click on the [Downloads for Windows] button. This will download the latest version of Git for windows.

(At the time of this writing, the file downloaded is named Git-1.9.4-preview20140920.exe.)

Step 4.2 - Install, choosing the ‘Use Git from Command Prompt’ option

Run the file just downloaded and choose default options until you get to the following screen.

Figure 3.4 - Git Path Option

Git Path Option

Make sure you select the Use Git from the Windows Command Prompt option.

Use the defaults for the rest of the installation.

Step 4.3 - Checking the Git Version

Close any existing command prompts and open a new command prompt. Make sure Git installed successfully by executing the command below.

Checking the Git Version

C:\Users\Chuck> git --version
git version 1.9.4.msysgit.2

Step 4.4 - Setup the SSH Key

Find Git Bash in the Windows Start Menu and execute the ssh-keygen command below. Press [Enter] all the way through to use the defaults and set up the SSH key with no pass phrase.

Creating SSH Key in Git Bash

Chuck@Windows ~
$ ssh-keygen -t rsa -C ""
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Chuck/.ssh/id_rsa):
Created directory '/c/Users/Chuck/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

Step 5 - Adding the Homestead box

This step downloads the Laravel Homestead Vagrant box.

Adding the Homestead box in Windows

C:\Users\Chuck> vagrant box add laravel/homestead
==> box: Loading metadata for box 'laravel/homestead'
    box: URL:


It can take a little while to download on slow connections.

Step 6. Installing Homestead

Now we’ll use composer to install the homestead command. This command line utility makes it easy to control the Homestead VM.

Step 6.1 - Globally requiring Homestead

Globally requiring Homestead 2.0

C:\Users\Chuck> composer global require "laravel/homestead=~2.0"
Changed current directory to C:\Users/Chuck/AppData/Roaming/Composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing symfony/process (v2.5.7)
    Loading from cache

  - Installing symfony/console (v2.5.7)
    Loading from cache

  - Installing laravel/homestead (v2.0.7)
    Loading from cache

Writing lock file
Generating autoload files

Step 6.2 - Updating Path

Composer just installed Homestead into the vendor directory of your Composer installation. (For example, C:\Users\YOU\AppData\Roaming\Composer).

In order to access homestead from any command prompt, add this path to your User path variable.

Follow the same steps to do this as you did back in Step 1.3 - Adding C:\Php to the path but this time the path to add will be below (replacing YOU as appropriate).

Paths to add


Notice the extra ‘vendor\bin’ in the path?

We’re adding this so any time you’re within the base directory of a Laravel project you can easily access any vendor utilities provided in that project. For example, Phpunit is installed in the vendor/bin directory of every Laravel application.

Step 6.3 - Verifying Homestead Installed

Close any existing command prompts and open a new command prompt so the latest changes to the path will be in effect. Then check the version of homestead to verify it installed.

Checking the Homestead Version

C:\Users\Chuck>homestead --version
Laravel Homestead version 2.0.7

Step 6.4 - Initialize Homestead

Once you’ve installed the homestead command and added the composer bin directory to your path, then you need to initialize Homestead.

Initializing Homestead

C:\Users\Chuck> homestead init
Creating Homestead.yaml file...
Homestead.yaml file created at: C:\Users\Chuck\.homestead/Homestead.yaml


You only need to initialize Homestead once on your machine

Step 7 - Bring up the Homestead VM

To bring up Homestead for the first time we’ll create a Code directory to store our projects and use the homestead up command.

Bringing up Homestead for the 1st time

C:\Users\Chuck> mkdir Code
C:\Users\Chuck> homestead up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default Checking if box 'laravel/homestead' is up to date...


Now the Homestead Virtual Machine is running. If you exit the Windows command prompt, the VM is still running. It’ll remain active until you issue a homestead halt command from the Windows command prompt.

You can log onto the Homestead Virtual Machine, but on Windows we won’t use the homestead ssh command, we’ll use PuTTY.

Step 8 - Setting up PuTTY

Windows does not provide a SSH client so we need to download and install one. For this book we’ll use PuTTY and set it up to log onto the Homestead VM.

Step 8.1 - Download and install PuTTY

Download putty-0.63-installer. Run this file to install PuTTY. You can just use the default installation settings.

Step 8.2 - Convert the SSH Key

Next find PuTTYgen in the Windows Start Menu and run it. Select the Conversions menu and then Import key. Navigate to the id_rsa file created in Step 4.4. Then click the [Save private key] button. Yes, you want to save the key without a pass phrase, and save it to the same directory—in my case it’s C:\Users\Chuck\.ssh—using the filename id_rsa.ppk.

Step 8.3 - Setup a Homestead PuTTY Session

Start up PuTTY and set the Connection | SSH | Auth private key to the id_rsa.ppk just created. Set the Session Hostname to vagrant@ and the port to 2222.

Save the session as the name homestead.

The first time you run this session you’ll have a confirmation box, but after that you’ll log onto the Homestead Virtual Machine without having to type a password.

You may want to create a shortcut on your desktop. The item you want the shortcut to point to is: "C:\Program Files (x86)\PuTTY\Putty.exe" -load homestead and name the shortcut homestead.

Change PuTTY’s Font

The default font PuTTY uses is Courier New, which to my eyes is ugly. You can go into Window | Appearance in the PuTTY configuration and change the font, size, colors, etc.

Step 8.4 - Connecting to Homestead via PuTTY

Execute the homestead session you just created in PuTTY and you should receive a screen similar to the follows.

Homestead’s first screen

Using username "vagrant".
Authenticating with public key "imported-openssh-key"
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-11-generic x86_64)

 * Documentation:

  System information as of Fri Nov 28 04:24:01 UTC 2014

  System load:  0.0               Processes:           92
  Usage of /:   5.2% of 39.34GB   Users logged in:     0
  Memory usage: 33%               IP address for eth0:
  Swap usage:   0%                IP address for eth1:

  Graph this data and manage this system at:

  Get cloud support with Ubuntu Advantage Cloud Guest:

Last login: Fri Nov 28 04:24:01 2014 from

Step 9 - Installing Laravel’s Installer

For the last step we’ll install the Laravel installer

Globally requiring Laravel Installer

C:\Users\Chuck> composer global require "laravel/installer=~1.1"
Changed current directory to C:\Users/Chuck/AppData/Roaming/Composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing guzzlehttp/streams (2.1.0)
    Downloading: 100%

  - Installing guzzlehttp/guzzle (4.2.3)
    Downloading: 100%

  - Installing laravel/installer (v1.1.3)
    Downloading: 100%

Writing lock file
Generating autoload files

Since your path was already updated in Step 6.2 to contain composer’s bin directory, the laravel command should already be accessible from a DOS Prompt. Verify it by checking the version.

Checking the Laravel Version

C:\Users\Chuck>laravel --version
Laravel Installer version 1.1


You now have a virtual Ubuntu 64-bit machine, ready for developing your Laravel 5.1 web applications.


This chapter was basically a long laundry list of steps to follow in order to get Laravel Homestead up and running on your Windows machine. The good news is, these steps only have to be performed once.

Now, skip to the Using Homestead chapter for some information about Laravel Homestead.

comments powered by Disqus