Laravel 5: Startup – Installation (Laravel 5 on XAMPP 3.2.2 / PHP 7.0.1)

STEP 1: Install Composer

Download Composer from here: http://getcomposer.org/download/
Install Composer.


STEP 2: Install XAMPP with PHP 7

Download XAMPP from here: https://www.apachefriends.org/download.html
Make sure XAMPP is powered by newest version of PHP 7.
Install XAMPP.


STEP 3: Prepare Laravel Installation

Check server requirements:

  1. PHP version >= 5.5.9
  2. OpenSSL PHP Extension
  3. PDO PHP Extension
  4. Mbstring PHP Extension
  5. Tokenizer PHP Extension

You can use phpinfo() for that.


STEP 4: Install Laravel Coding Environment

Info:
Laravel coding environment is a place (framework environment), where you code your app.
There is more than one way to install Laravel coding environment for your App.
Let’s see them all – with some sample code.

way #1:  Install using Laravel Installer (via Composer)

First, we need Laravel installer downloaded – unless we have already done so before, e.g. for a different app.
Laravel seems to install its Installer to:

So, regardless where you are in your Command Prompt, Laravel installer will be found by Windows.
You may want to physically go to above directory to see, if it there.

Here is how to get Laravel installer:

  1. open your Command Prompt
  2. type in code:

Once installation is done, so are you … with this task.

Note:
You have to register Laravel installer path with your Windows “Path” environment variable.
Check here how it is done.

To do all installations, you are going to use Command Prompt, as you are installing local coding environment on Windows using XAMPP.

For anything done on server you most likely need something like Putty (instead of Command prompt).
On Linux, you’d need console … etc.
But this is out of scope of this “tootsie”, so I will not go into that.

So, let’s see different approaches leading to get you ready to code in Symphony’s offspring – Laravel.
Here is what to write into Command Prompt, to prepare Laravel coding environment.

option #1

If you registered Laravel installer path with “Path” environment variable (see several lines above), you should:

  1. go to directory, where you wish to install your project using Command prompt

    By typing above command to Command Prompt, you will switch to folder: my_projects.
    Inside of that project, you will install your Laravel coding environment.
    Of course, you can change folder: my_projects directory, to a real one you have on your server.

    If, your project directory is on different hdd, e.g. U: (as mine are), you need to switch disks before running code shown above:

  2. install your Laravel coding environment inside of directory selected above by using code like this

    Now, your Laravel coding environment is installed to: c:\my_projects\my_app

Note:
We are still not ready to go to browser and see initial welcome page.
But in a little while we will be able to.
Lets proceed and see other options, how to get Laravel coding environment in place using Laravel installer.

option #2

If, for whatever reason you do not want to, or you cannot register laravel installer path with “Path” environment variable, you can get your environment working without updating PATH enviroment variable for your Windows.

Here is how: go to directory, where you wish to install your project – see option #1 above how and install your Laravel coding envir. by using absolute path to your laravel installer.
It should look something like this:

Above code should install your Laravel coding environment into c:\my_projects\my_app

option #3

If, in addition to case described in option #2, you do not want to bother switching to directory, where you want to keep code for your app (which amounts to same place, where you install your Laravel coding environment) , you may use another absolute path to get the job done.

It is going to look like this:

Above code should have your Laravel coding environment (where you develop your app) installed using a single line of code in your Command Prompt.

So, if you are lazy (as any coder I have ever met), you may consider option #3.

If you register Laravel installer with Windows PATH envir. variable, you will save on typing those long absolute paths when launching future Laravel app environments.

Kind of: pay me now, or pay me later stuff.

way #2:  Via Composer Create-Project Command

If you wish to avoid all these tasks with installing Laravel installer and registering it with PATH, you can use Composer internal command: Create-Project to get your app coding environment ready.

option #1:

Use relative paths.

  1. first get inside of folder, which will hold your app folder using Command Prompt

    Of course, you can change folder: my_projects directory, to a real one you have on your server.
    If, your project directory is on different hdd, e.g. U: (as mine are), you need to switch disks before running code shown above.
  2. then use composer command in Command Prompt to get Laravel coding setup for your app.

    Now, your Laravel coding environment is installed to: u:\my_projects\my_app

option #2:

Use absolute paths.

You can combine option #1 code into one line, by using absolute path:

Now, your Laravel coding environment is installed to: c:\my_projects\my_app

 


NOTE:

If you want to install given version, use this code: