Laravel is an open-source PHP framework, follows the MVC (model–view–controller) pattern. Laravel reduces the time of web development and helps to make web applications secure. Some key features make Laravel more powerful for building large and robust web applications.
Laravel has the following key features which are most required for modern web development.
In this Laravel tutorial, we’ll go through the installation and configuration process of Laravel. This step-by-step guide for beginners will help you to install and configure Laravel framework on Windows or Ubuntu servers easily.
Before getting started with Laravel installation, make sure your server meets the following requirements.
Laravel uses Composer to manage dependencies. So, before installing Laravel, make sure that the composer is installed in your system.
1. Download the Composer-Setup.exe file on your system and run the installer. It will install the latest version of Composer.
2. Once the Composer is installed, open the command prompt and type composer
command to check the installation status.
1.Update packages and dependencies:
Before download and install Composer, make sure all the packages are updated and their dependencies are installed.
Run the following command to update packages:
sudo apt-get update
The following dependencies are needed to install.
Install all the dependencies by the following command:
sudo apt-get install curl php5-cli git
2. Download and install composer:
Run the following commands to get the latest Composer version. These 4 lines commands will do the 4 things.
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');"
Now move composer.phar
file to the /usr/local/bin/
directory by running the following command:
sudo mv composer.phar /usr/local/bin/composer
Alternatively, you can use the following single-line command to download and install Composer in the /usr/local/bin
directory on Ubuntu.
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
3. To test Composer installation, use the following command:
composer
Assume that you want to install Laravel on the XAMPP server in Windows.
1. Open the Windows command prompt and navigate to the C:\xampp\htdocs
directory.
cd C:\xampp\htdocs
2. Run the following command to install Laravel in C:\xampp\htdocs\laravel-app
directory.
composer create-project laravel/laravel laravel-app
Laravel installation will start, wait for completion.
1. Install Via Laravel Installer:
At first, download the Laravel installer using Composer:
composer global require laravel/installer
Create a fresh Laravel installation in a specific directory (for example, laravel-app
):
laravel new /var/www/html/laravel-app
2. Install Via Composer Create-Project:
Create a fresh Laravel installation in laravel-app
directory:
sudo composer create-project laravel/laravel /var/www/html/laravel-app
Run the Laravel project URL on the browser (http://localhost/laravel-app/public/
). If Laravel is installed successfully on the Windows server, the below screen will appear.
Laravel development server: You may start Laravel local development server using the following command.
cd laravel-app php artisan serve
Go to the Laravel project (laravel-app) directory:
cd /var/www/html/laravel-app
Start Laravel development server:
php artisan serve
The terminal will show the below screen, copy the development server URL.
Run the development URL on the browser (http://localhost:8000/
). If Laravel is installed successfully on the Ubuntu server, the following screen will appear.
Hope this Laravel tutorial for beginners helps you to install and configure the Laravel framework on Windows and Ubuntu server. Follow this step-by-step guide to install Laravel 8 on Xampp. Once installation or configuration is completed, you can go through the next part of the Laravel tutorial.
Do you want to get implementation help, or enhance the functionality of this script? Click here to Submit Service Request