Objective

The main objective of this blog post Install Laravel 5 on windows and upgrade Laravel 5 from previous versions

 

 

Step 1 Introduction

This blog is about installing Laravel 5 keeping in mind that the reader has the fundamental knowledge of the PHP, and any of the web server application such as: XAMPP, LAMP, WAMP and some more. Reader should also have knowledge about the core and advanced PHP MVC structure.

Laravel is till date the most powerful and flexible PHP framework developed by Taylor Otwell. Laravel 5.0 has a new application structure that provides better theorem for building robust application. Laravel 5.0 embraces new auto-loading standards (PSR-4) in application.

Laravel Framework has some requirements:

  • PHP version 5.4 or above
  • Mcrypt PHP Extension
  • OpenSSL PHP Extension
  • Mbstring PHP Extension
  • (If you have installed web server XAMPP, you can simply know if you have already those extensions using localhost/xampp/phpinfo.php in browser after starting apache)

Laravel follows the PSR-0 and PSR-1 coding standards. Also some additional coding standards should be followed:

  • The class namespace declaration must be on same line as
  • A opening { of class must be on the same line as the class name.
  • Function and control structure must be Allman style braces.
  • Indent with tabs, align with spaces.
 

Step 2 Installing Laravel:

 

2.1 Installing Composer:

To use laravel 5.0, you need to install Composer (To download composer click on link: Composer-setup). Composer is the tool for dependency management in PHP application. It installs the external dependent libraries which your project requires.

 

2.2 Downloading Laravel 5.0

(By default, latest version of laravel will be installed): You can download Laravel 5.0 in two ways:
 

 

2.2.1 With Laravel Installer

Place the "home/composer/vendor/bin" directory in to your PATH so the laravel can work.

After installing Composer, you can download laravel installer using Composer:

composer global require "laravel/installer=~1.1"

After laravel is installed, you can create a new Laravel application in the directory which you want, using laravel new demo command (here demo is the directory name). Now you have the directory demo which contains Laravel Installation will all dependencies.
 

 

2.2.2 With Composer create-project

You can install Laravel 5.0 using the given command:

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

You can change time zone and locale according to you application in config/app.php file.

 

2.2.3 Upgrade Laravel 5.0 from 4.2:

To upgrade laravel 5.0 from 4.2, official laravel recommends installing laravel 5.0 and then replacing 4.2 directory files with 5.0 in to the new application.

Note: Some laravel specific packages may not be compatible with the laravel 5.0. So, you need to run composer update command.

You need to copy the .env.example file to .env which is the equivalent of .env.php file. Laravel 5.0 does not use the app/config/{environmentName}/ directory. To access environment, move env(‘key’, ‘default value’) in to your configuration file. Set the config files into the config/ directory.

Replace your old routes.php file by app/Http/routes.php.

Move controllers into the app/Http/Controllers directory, and add this directory to classmap directive in to the composer.json file.

Move views from app/views to resources/view directory, and app/lang to resources/lang. In Laravel 5.0 Remote and Workbench components are removed.

 

Step 3 Naming Applicaion

When laravel is installed, you should name you application. Just using command in composer as follow:
php artisan app:name your_application_name

When you application is in maintenance mode, HttpException will be thrown with 503 status code.

To enable maintenance mode just execute php artisan down command. And to disable the maintenance mode simply execute php artisan up command.

I hope you find this blog is very helpful while working with Laravel 5. Let me know in comment if you have any question regarding Laravel. I will help you ASAP.

Got an Idea of Web Development? What are you still waiting for? Contact us now and see the Idea live soon. Our company has been named as one of the best Web Development Company in India.

I am a Web Developer working for The App Guruz. I love my work and enjoy each new project as I get it.