System Requirements
If you are not using a virtual machine, ensure that your system meets the following requirements:
-
PHP version 7.0 or higher
-
OpenSSL extension for PHP
-
PDO extension for PHP
-
Mbstring extension for PHP
-
Tokenizer extension for PHP
-
XML extension for PHP
Table of Contents
-
Composer
-
Setting Up Laravel Using the Installer
-
Creating a Laravel Project
1. Composer
Laravel uses Composer to manage dependencies. Before using Laravel, ensure that Composer is installed on your system.
If you haven't installed Composer, download it from the official website: Composer Download
After installation, verify Composer by running the following command in your terminal or command prompt:
composer
This will display the Composer version and usage instructions.
Setting Up Composer's System-Wide Vendor Directory
To allow Laravel commands to be executed globally, ensure that Composer’s vendor bin directory is in your $PATH
:
-
macOS:
$HOME/.composer/vendor/bin
-
Linux:
$HOME/.config/composer/vendor/bin
2. Setting Up Laravel Using the Installer
First, install the Laravel installer globally using Composer:
composer global require "laravel/installer"
Once installed, you can create a new Laravel project using:
laravel new project_name
3. Creating a Laravel Project
To create a Laravel project manually, follow these steps:
-
Navigate to the directory where you want to create your Laravel project.
-
Run the following command to install Laravel:
composer create-project --prefer-dist laravel/laravel blog
-
After installation, start the Laravel development server using:
php artisan serve
This will start the Laravel server, and you will see the message:
Laravel development server started on http://localhost:8000
-
Open your browser and visit: http://localhost:8000