PressTigers

How to Install Laravel with Composer on Windows

Laravel is a PHP 5.3 framework known as “A Framework For Web Artisans”. Developers using Windows OS find difficulties while installing such an application, so they can take guidance for their ease from this tutorial.

It includes the installation of Laravel with Composer on Windows, so stay focused and follow the below mentioned steps one by one with full concentration:

Step1

For setting up the development environment for Laravel application, you need to install and configure the following extensions on your system:

  • PHP >= 5.5.9
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension

You can use any Apache server like wamp/xampp. Make sure that you have the latest version of PHP. The above mentioned extensions should be enabled because right after that Laravel 5.1 will be installed. You can check it from your Apache PHP info whether the required extensions are enabled or not.

Step 2

After the environment setup, you are good to go to install Laravel application on your system. For this, you need to install Composer on your system. Download the Composer Windows installer from here.

laravel-composer-1

Note: Composer should setup the environment variable for your Laravel application. If it doesn’t then you have to add it yourself.

Step 3

For setting up the environment path variables:

  • Go to Control Panel > System and Security > System > Advanced System Settings
  • Go to the Advanced tab
  • Click “Environment Variables…”
  • Under “System Variables” select to “Path” and click “Edit…”
  • Now add the following:
    ;C:Users{system_username}AppDataRoamingComposervendorbin to the end.
    IMPORTANT: There must be a semicolon before it and no slash or semicolon after it

If you have already installed composer, don’t forget to run composer self-update. If you didn’t then just leave it.

laravel-composer-2Step 4

Now Composer has been installed. Also verify that environment variable for composer has been set. Without setting the environment variable, composer ignores additional dependencies needed for Laravel applications. For creating a Laravel project, follow the steps mentioned below:

1- Open command prompt and type ‘composer‘. If composer is installed and running, it will display the composer information as you can see in the screen shot:

laravel-composer-3

2- Navigate to directory where you installed your Apache server. For this tutorial, D://server/ has been used. Now type the following command in command prompt:

composer create-project laravel/laravel –prefer-dist

This will download Laravel framework and create new folder name ‘laravel‘ with all dependencies already installed in this folder. You will be facing an error while downloading ‘phpunit‘ as it will ask for GitHub authorization token.

Step 5

Go to GitHub and create a profile if haven’t create it yet. After creating a GitHub account, go to your account settings -> Navigate to “Personal Access Token” -> Create New token.

Now give name to your token e.g. “laravel_dev” and tick all the check boxes under the token name and then click “Create Token“. When a token is created, copy it for your record because you will not be able to see that particular token once you navigate to another page.

laravel-composer-4

Now you have to paste the token in your command prompt where it asked for enter the token.

laravel-composer-5

After this, you have to click “Enter” from your keyboard. Your Laravel project creation will be completed.

Step 6

Navigate to your installation directory of Laravel application and run this command:

php artisan serve

It will start the development server for your Laravel application.

laravel-composer-6

Open your browser and enter this URL “http://localhost:8000” in the address bar. Don’t forgot to add “Port number”. If everything works fine, you will be able to see the Index page of your Laravel application.

laravel-composer-7

You have successfully created and installed your first Laravel application on your Windows system. Feel free to ask if you have any questions regarding this tutorial.

User Comments

1 thought on “How to Install Laravel with Composer on Windows

    Kayode Akinyemi says:

    Worked perfectly for me.

Leave a Reply

Your email address will not be published. Required fields are marked *

    Get in Touch