Welcome to the Beginner Guide to Install Laravel on Your Operating System! Laravel is a very popular framework of PHP. Due to its unmatched simplicity and fast speed Laravel has become a need of every PHP developer.
Here we will be explaining installation of Laravel framework in very simple steps. This guide is very useful for Laravel learners at very beginner level. This guide is mainly targeted on installation for windows operating system.
By the end of this setup tutorial, you’ll have Laravel up and running on your system. You can start your web development journey of building dynamic web applications with one of the most popular PHP frameworks.
Before we move forward with installation, let’s first dive in some necessary prerequisites.
Pre-requisites to Install Laravel
Here are a few prerequisites that you need a lot for install Laravel:
- PHP: The recommended version for PHP is 7.3 or higher than it with extensions like XML, OpenSSL, PDO, etc.
- Composer: Composer is package manager for PHP. It sets the group for the installation of both Laravel and its dependencies.
- Web Server: Along with PHP and Composer, web servers play a crucial role in the installation of Laravel. You can try adding web servers like Apache for the applications going to the run under Laravel.
- Database: How can we forget database? Do you know that Laravel can work with multiple database systems but we will be using MySQL.
- Node.js and NPM: Although not required, Node.js and NPM (Node Package Manager) are often used for front-end development tasks like compiling assets and managing JavaScript dependencies in Laravel projects. We may need it for SAAS integration with Laravel here.
To setup PHP, MySQL, Web Server on Windows I recommend to install WAMP or XAMP. These stacks will give you single click setup for all.
You must ensure, you have these prerequisites installed and configured correctly.
Steps to Install Laravel on Windows
To install Laravel on Windows, first, we have to download the composer from its website., As we’ve read above, it is a command line and will help us to install Laravel.
1. Installing composer
Download the composer from it’s official website, and start the setup. It will ask you to provide the PHP path as shown in the below image:
Then press next and install the composer, after installing it successfully we can check the version of the composer in the command prompt by using this command:
Composer - v
It will show some information as shown in below attached graphic for reference:
With this step, we’ve got everything set to install the Laravel in your operating system.
Follow the provided steps with good attention for right installation:
2. To install the Laravel we should use at least PHP 7.3 version while writing this
We can check the version of PHP in command prompt of windows by using:
PHP –v command
3. Install Laravel
After downloading the composer and installing it in the windows, we have to start the installation process of the Laravel. We can follow the below-mentioned commands to install Laravel:
Composer create-project –prefer –dist laravel/laravel Project_Name
This command will install Laravel and also make a new project with the given name of the project.
4. Create the PHP database in MySQL
After installing Laravel, we have to create the database in the PHP server, just go to the MySQL server, create a new database.
5. Update. Env file
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:TJ9Sob7KFPhL5XkqT+TyQux3x7UbW08QLb0xtirLWSs=
APP_DEBUG=true
APP_URL=http://127.0.0.1:8000
LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=first-laravel
DB_USERNAME=root
DB_PASSWORD=
6. Migrate database
After creating the database for Laravel, we will create a migration table. To make a migration table we will use the command as:
php artisan migrates the above command
This Command will create the pending migration changes to the database.
7. Start the development server of the Laravel
To start the server of the Laravel we have a command to run:
php artisan serve
This command will start the server of the Laravel, as we can see in the image reference below:
Now we are done. We can copy this localhost URL and paste it into the browser to check if it is working. We can see the welcome page of the Laravel like this.
Ready to Take Your Laravel Skills Further?
Explore advanced Laravel techniques with ADMEC Multimedia’s certificate course. Master MVC architecture and build robust web applications with PHP Laravel.
Or you have another way! Why not consider the bigger picture?
Our 24-month Web Design and Development Course at ADMEC Multimedia offers far more than just a single framework installation.
Don’t limit yourself to just one framework – expand your skills and become a multi-skilled web developer today. Checkout our comprehensive course at the Web Development Institute in Delhi.
Conclusion on Beginner Guide to Install Laravel
That’s how we can install Laravel on a Windows OS successfully. Start with the composer installation and that will help us to install Laravel on our Windows operating system. Follow all of the above-mentioned steps to install Laravel. But make sure that, you already have a localhost server Installed like WAMP or XAMP.