Laravel

How to Install Laravel Composer and PHP on Windows

How to Install Laravel Composer and PHP on Windows

Install Laravel Composer

Perquisites
1. Download and Install Visual C++
   install Visual C++ Redistributable for Visual Studio
   VC_redist.x64.exe (64 bit) or VC_redist.x86.exe (32 bit)

2. Download and Extract PHP
  A. Go to the Windows PHP download page and download the .zip of the version of PHP you require.
      We are installing PHP 8.2 VS16 x64 Non Thread Safe (2023-Jan), which is the latest version.
  B. Once downloaded, create a new folder in c:\php8 (or wherever you prefer) and extract your PHP zip to it.

3. Download and Install Composer
   Download Composer-Setup.exe from the Composer Download page.

   In the second step of Composer Setup, make sure the correct path to php.exe is set and click Next.
   If Setup prompts to create php.ini, allow it and click Next.
   Skip the Proxy URL settings, just click Next then click Install.
   Click Finish once install is complete.

4. Test PHP
   If you have any Command Prompt windows currently open, close them now.
   Open Command Prompt, type php -v and press Enter. You should now see the PHP version.

5. Add Path Environment Variable
    If for some reason composer setup didn't take care of it for you, you can set one up manually.
    Add c:php8 as an environment variable so that you don't have to type the complete path to php.exe each time you perform a PHP command.

6. Test Composer
    Open up Command Prompt and type composer -V (that’s uppercase V).
    If all was installed correctly, you should see a version number.



Install Laravel & Create new Project

Mode 1: Install Laravel Environment Via Laravel Installer

Step 1: download the Laravel installer using Composer.
          composer global require "laravel/installer=~1.1"

Step 2: place the ~/.composer/vendor/bin directory in your PATH
          so the laravel executable is found when you run the laravel command in your terminal.

Step 3: Create a New Laravel Project
         laravel new blog
         above command will create a fresh Laravel installation with all dependencies installed.


Mode 2: Install Laravel Environment and Create New Laravel Project


Step 1: Run following command in the terminal window   
         Create a new directory anywhere in your system for your new Laravel project. After that, move to path where you have created the new directory and type the following command there to install Laravel.
        composer create-project –-prefer-dist laravel/laravel H:\xampp\htdocs\empty_project_folder_name

        OR

        composer create-project --prefer-dist laravel/laravel .
       
The above command will install Laravel in the current directory


  

Start Lavavel Service
       
php artisan serve





Related Post

About Us

Community of IT Professionals

A Complete IT knowledgebase for any kind of Software Language, Development, Programming, Coding, Designing, Networking, Hardware and Digital Marketing.

Instagram