In this guide, we will be covering everything you need to know about installing and setting up Laravel 11 for the first time on Windows.
We will walk you through the step-by-step process of installing Laravel. Laravel is a free and open-source PHP-based web framework for building web applications based on the MVC (Model-View-Controller) architecture.
You can find the online version of the Laravel documentation at
XAMPP is an open-source package that provides a local web server environment for testing and development. XAMPP stands for Cross-Platform, Apache, MySQL, PHP, and Perl.
Download XAMPP
http://www.apachefriends.org
Copy the path to PHP to the environment variables. Search for environment variables and click on "Edit the system environment variables"
Next, click on "Environment Variables"
Double click on "Path" then click on "New" and paste the path. For me, I pasted
C:\xampp\php
Click on "Ok"
Now, you have properly added PHP to your device.
Open Command Prompt, and type
php --version
Now, you can see PHP is properly added
PhpStorm is the go-to full-stack IDE for the most popular PHP frameworks, including Laravel, in addition to PhpStormโs deep understanding of vanilla PHP code.
Download PhpStorm
http://www.jetbrains.com/phpstorm
Alternatively, Visual Studio Code is a great editor for PHP development.
Download Visual Studio Code
Download DataGrip
DataGrip is a database IDE that supports various databases like MySQL and more.
http://www.jetbrains.com/datagrip
Alternatively, you can connect to MySQL in Visual Studio Code by installing the MySQL extension from the VS Code Extensions Marketplace.
Before creating your first Laravel application, make sure that your local machine has Composer
http://getcomposer.org/doc/00-intro.md
Download and run Composer-Setup.exe
If you already have PHP and Composer installed, you may install the Laravel installer via Composer:
composer global require laravel/installer
In your terminal window output, if you received the following error
The zip extension and unzip/7z commands are both missing
Open XAMPP control panel,
Click on "Config" for the Apache module and open php.ini
Search for "zip" by typing ctrl + f
Remove (";") from ;extension=zip
Check the Laravel installer version of your project
laravel --version
After you have installed PHP, Composer, and the Laravel installer, you're ready to create a new Laravel application. Open terminal, navigate to your projects directory then type
laravel new example-app
Next, you will be asked the following in the terminal output:
Would you like to install a starter kit? Enter none, breeze, or jetstream.
Which testing framework do you prefer? Enter 0 for Pest or 1 for PHPUnit.
Which database will your application use? Enter sqlite, mysql, mariadb, pgsql, or sqlsrv.
Would you like to run the default database migrations? Enter yes or no.
Once the application has been created, then type
cd example-app
npm install && npm run build
composer run dev
Did you receive the following error in your terminal output?
"The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program"
The reason is this could be because of the absence of Node.JS on your computer
Install Node and NPM so that you can compile your application's frontend assets.
If you receive the following in your Visual Studio Code IDE terminal output,
"The token '&&' is not a valid statement separator in this version"
Please refer to
http://code.visualstudio.com/docs/editor/integrated-terminal#_configuration
Navigate to your project directory in terminal, then type
php artisan serve
In the browser, we can see the server running on
http://127.0.0.1:8000
The source code of the page you're seeing is in the welcome.blade.php file located in
example-app/resources/views/welcome.blade.php