How to install Laravel on WAMP for beginners

Posted by Darwin Biler on September 30, 2013

When you go to the QuickStart page of Laravel, one thing you will notice in the installation instruction is it has an assumption that you knew what is Composer and some advance knowledge of PHP. This assumption makes it hard for beginners to penetrate Laravel. Some people out there might know MVC from other frameworks, but these new tool is totally new for them, so in this post, we will try to smooth the learning curve a bit and make it easier to get started with this great framework.

Lazada Philippines

First thing first,  before you open that command window and type composer commands and etc. You need to know what you are doing first.

1. Some knowledge about MVC - if you don't know what MVC is, it is a must that you do read about it first. This wiki link is a good read and preferably try some lightweight MVC framework first like CodeIgniter to gain some experience on how developing on a MVC framework looks like. Having other basic MVC framework first will  help you appreciate the power of Laravel.

2. WAMP -  is an acronym for Windows Apache MySQL PHP. You probably knew about this one already. In case not yet, for God's sake please do. You can download WAMP here.

3. Configure OpenSSL - OpenSSL what? SSL means Secure Socket Layers, this will gonna needed by Composer to run properly. It's a PHP extension that needs to be enabled before installing Composer.

Common Mistake!
Most of the people thinks the proper way of enabling it is by clicking the WAMP icon, then going to PHP > PHP Extensions > php_openssl. Well no. Because that setting edits the C:\wamp\bin\apache\Apache2.4.4\bin\php.ini Which is NOT the php settings read by Composer, you should manually edit the C:\wamp\bin\php\php5.4.16\php.ini instead. Why? because Composer is run from the command-line, not inside WAMP, thus it will read the php.ini file inside C:\wamp\bin\php\php5.4.16\ not C:\wamp\bin\apache\Apache2.4.4\bin\. Look for the line with extension=php_openssl.dll on it, and make sure that line has no semicolon on its front.

2

3. Install Composer - is a dependency manager. Why dependency? Because Laravel is highly "dependent" on other library as well. Yes, Laravel is made out of other libraries, like Symfony and Doctrine (don't worry about these terms for now), each library has different versions and some libraries is dependent on other libraries as well, Composer does all the tracing of all of these for you . What is important for now, is you understand what composer is and what role it plays in developing in Laravel. You can download Composer for Windows here.

Important!

You need to install WAMP first before installing Composer. Why? because composer needs php to run. Without WAMP (thus, no PHP) you wont be able to run Composer.

4. Install Laravel - At this point, let me re-introduce to you the QuickStart page.The doc says:

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

Lazada Philippines

But before doing that, make sure you are in the correct folder (though of course advance users can make aliases). Most likely you want the project to be loaded inside the WAMP www directory, so go there first.

cd c:\wamp\www

Now execute that famous "quick-start" installation instruction. Note that you should replace the "--prefer-dist" part with the folder name you want Laravel to be installed. For example, issuing this command:

composer create-project laravel/laravel laraveltest

will create a project that can be loaded in http://localhost/laraveltest/public/index.php
So make sure to make the right choice of folder location.

After reading this post, you probably have a good knowledge now what's going on, instead of blindly typing commands in the console window. Now go on, explore Laravel.