First time installing Laravel on Windows seems difficult for someone like me. That’s why, I’m writing step by step procedure on how to install laravel on Windows.
Step-01: Download Composer
At first, we need to setup the composer. For this, Go to composer’s website and download the Composer-setup.exe file from the Windows installer Section.
Step-02: Install Composer
Install the composer into your computer. When installing composer, Remember the following:
— Select “Do not install Shell Menus”
— Locate the PATH of php.exe , if you’re using XAMP that is installed into your C drive, then the Path is similar to like this: C:\xampp\php\php.exe
If the composer installation is done properly, then open the command prompt (Go to Run->cmd), write :
If Everything is Okay, then you’ll see this:
If the “composer” command didn’t work yet, then just find and check the file composer.bat and if anything is not written in this file, then write within the composer.bat file:
@ECHO OFF php “%~dp0composer.phar” %*
Step-03: Install Laravel with Composer
Now, it’s time to install Laravel on your Computer via Composer. Now you can install Laravel by issuing the following command from your terminal:
composer create-project laravel/laravel your-project-name --prefer-dist
This command will download and install a fresh copy of Laravel in a new
your-project-namefolder within your current directory.
If you prefer, you can alternatively download a copy of the Laravel repository from GitHub manually. Next run the
composer installcommand in the root of your manually created project directory. This command will download and install the framework’s dependencies.
Step-04: Serving Laravel
Typically, you may use a web server such as Apache or Nginx to serve your Laravel applications. If you are on PHP 5.4+ and would like to use PHP’s built-in development server, you may use the
php artisan serve
** N.B: For running this command, you’ve to set the PATH of php.exe to the Environment variable value. For instruction, go to Step- 07.
Now, if you want to dig more and want to install Laravel via Laravel installer ( I prefer to use Laravel with Laravel installer)
Step-05: Install Laravel globally on Windows via laravel installer
If you already checked laravel.com website, then you saw that in the quick installation section, you’ll get this instruction (via laravel installer):
First, download the Laravel installer using Composer.
composer global require "laravel/installer=~1.1"
Make sure to place the
~/.composer/vendor/bindirectory in your PATH so the
laravelexecutable is found when you run the
laravelcommand in your terminal.
In Windows, you’ve to Find out where you installed the composer, “ComposerSetup\bin” folder. In my case, it is:
Now, Set the PATH to the Environment variable value. If you don’t know how to set PATH to the Environment Variable, then go to Step-07.
Step-06: Download Laravel via Laravel Installer
Now, just write the command anywhere and your laravel framework will be downloaded into the specific folder.
laravel new testLaravel
Step-07: Set the PATH to Environment Variable
Right-click on computer and Select Properties
Go to: Advanced System settings->Environment variable->Select Path->Edit
Then append the path of the composer.phar to the environment variable.
Note that, DO NOT Use <space> or quotation within the value of Environment variable. Also separate paths with ‘;’ (omit the quotation here).
Thank for your post. It’s easy. Just try Laragon. Help me to set it up in 1-click.