How to Install Laravel on Windows

In a previous post I mentioned how Symfony offers a collection of decoupled components, which can be a benefit when you do not wish to commit to a full-fledged framework. Recently, however, I needed to quickly create a PHP application for a work project and decided to use Laravel – the most popular PHP framework – as I knew I could get it up and running quickly.

Here are my very brief notes on how to do so in a Windows server environment:

First, I installed a Wamp server:

Wamp is a quick installer that generates PHP, MySQL, and an Apache web server.

Second, you will need to install Composer if you do not already have it running on your machine.:

Composer is a dependency management tool that will allow you to install components in PHP.

Note that during the installation it will allow you to choose the command line PHP you want to use. Mine correctly defaulted to the PHP installation within my Wamp directory. If it does not do so or if you have installed Wamp on another drive, you will want to navigate to php.exe that is located within your Wamp folder.

Finally, create the Laravel project for your application.

The easiest way to do so is to open a command prompt, navigate to the www folder within your wamp directory, and enter the following:

composer create-project –prefer-dist laravel/laravel myproject

Change the ‘my project’ name to whatever you wish to call your application. (Note: the dash before ‘prefer’ in the above command line should be a double dash; WordPress is converting it to an em-dash.)

After that, from the command line you can navigate to your new project directory and verify the installation with the following command:

php artisan serve

You should get a message that says something like:

Laravel server started on http://localhost:8000

Visit that url in your browser and you should see the default Laravel screen, meaning your installation is successful.

For a video walkthrough, see Rakshith Vasudev’s excellent Laravel series.

Reading From SQL Server with Symfony

After you have installed Symfony and configured the database connection, you will want to write some code to retrieve data from the database.

Install Doctrine

The first step involves installing the Doctrine library to map your database. To do so, open a command prompt and navigate to your project directory. Then enter the following installation command:


composer require doctrine/doctrine-bundle


You should eventually get a message saying all assets were successfully installed.

Finally, enable the bundle by adding the following to the $bundles array inside the registerBundles function in the app/AppKernel.php file:


new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),


Create a Class for Your Data

Next you will need to create a class (aka entity) to map and hold the data from your database.

Create an Entity folder inside src/AppBundle. Within that folder create a class file (ex. Employee.php) with the following code:


namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

* @ORM\Entity
* @ORM\Table(name=”tablelNameGoesHere”)

class Employee {
* @ORM\Column(type=”integer”)
private $ID;

* @ORM\Column(type=”nvarchar”, length=255)
private $FIRST_NAME;

* @ORM\Column(type=”nvarchar”, length=255)
private $LAST_NAME;


Note that you will want to change your field names and data types to match the database you are using.

Also note that instead of using the PHP annotations above, you could use YAML or XML as explained in this Symfony Doctrine page.

In a subsequent post, I will describe how to read and display data.

Connecting Symfony to SQL Server

This is the second of my posts documenting how I configured the PHP Symfony framework for Windows. For work, I needed to connect my Symfony installation to SQL Server. There are two steps to do so: install the driver and update the configuration settings.

First, download the Sql Server driver:

Then copy the appropriate dll to your PHP ext folder.

This page will tell you which dll to choose:

Next, add the dll file name to your php.ini config file, like this:


Then restart the web server.

Finally, you need to update the Symfony config. In your app/config folder change the driver under the doctrine section to:


For security reasons, your other configuration settings will likely already be set to variables. Those variables can be found in parameters.yml.

In the parameters config, update any connection settings as necessary to match the setup of your database.

Basic Symfony Installation for Windows

I recently had to install Symfony, the PHP component-based framework, for a work project. There is extensive documentation on the Symfony site, however I thought I would post a quick start guide with the essential steps for getting Symfony up and running quickly on a Windows server environment.

Why Symfony?

I chose Symfony because it was the least framework-like method for structuring a PHP application. In reading Josh Lockhart’s ‘Modern PHP’ this past year, he notes that the problem in choosing a traditional framework is that you are committing to that framework’s future. Additionally, frameworks have a wide variety of tools, but sometimes you just need something specific, which the framework may not provide. Symfony, on the other hand, is a collection of decoupled components that can be used in isolation or as part of a framework.

Installation Steps

The easiest way that I found to install Symfony is with Composer, the dependency management tool for PHP.

There are three steps: install Composer, create a Symfony project, and start the server.

1. Go to the Composer site and download and run the application via the executable.

2. Open a Windows command prompt and enter the following command (change ‘project_name’ to whatever you want to call your project):

composer create-project symfony/framework-standard-edition project_name

Composer will then execute a series of commands. At some point it will ask you for database credentials. You can hit enter for each one to leave them at their defaults initially. Of course, before moving to a production environment you will want to change these.

Eventually, you will get a message saying all assets were successfully installed.

3. Finally, navigate to your directory and start the server with the following two commands (for ‘project_name’ enter whatever you named your project in step two):

cd project_name/

php bin/console server:run

Symfony should now be installed. You can verify this by pulling up http://localhost:8000/ in your browser, where you will get a Symfony welcome message.