To install Laravel, you’ll need to have a development environment set up on your computer. Laravel is a PHP framework, so you’ll need PHP, Composer, and a web server (such as Apache or Nginx) to run Laravel applications. Here are the steps to install Laravel:
Install Prerequisites:
- PHP: Laravel requires PHP 7.4 or higher. You can check your PHP version by running
php -v
in your terminal. If you don’t have PHP installed, you can download it from the official PHP website (https://www.php.net/). - Composer: Composer is a PHP package manager. You can download and install Composer from the official website (https://getcomposer.org/download/).
Install Laravel:
Once you have PHP and Composer installed, open your terminal and run the following command to install Laravel globally on your system:
composer global require laravel/installer
This command installs the Laravel installer, which allows you to create new Laravel projects.
Create a New Laravel Project:
After installing the Laravel installer, you can create a new Laravel project using the following command:
laravel new project-name
Replace project-name
with the desired name of your Laravel project.
Start the Development Server:
Navigate to the project folder you just created:
cd project-name
Start the Laravel development server by running:
php artisan serve
This command will start the development server at http://localhost:8000.
Access Your Laravel Application: Open a web browser and visit http://localhost:8000
to access your newly created Laravel application. You should see the Laravel welcome page.
You have successfully installed Laravel and created a new Laravel project. You can now start building your web application using Laravel’s powerful features and tools. Make sure to refer to the official Laravel documentation (https://laravel.com/docs) for detailed information on how to use Laravel for your project.