How do you install Laravel?

Laravel is a popular PHP framework for building modern web applications. Installing Laravel is straightforward, especially if you have the required tools ready. In this guide, we’ll go through the process step-by-step.

1. Check System Requirements

Before installing Laravel, make sure your server or local machine meets these requirements:

PHP: Version 8.1 or higher

Composer: Installed

Database: MySQL, PostgreSQL, SQLite, or SQL Server

Extensions: OpenSSL, PDO, Mbstring, Tokenizer, XML, Ctype, JSON, BCMath, Fileinfo


2. Install Composer

Laravel uses Composer to manage dependencies.

If you don’t have Composer installed, download it from:

https://getcomposer.org/download/

composer -v


3. Install Laravel via Composer

composer create-project laravel/laravel myapp

Here, myapp is the name of your project folder.


4. Navigate to Project Directory

cd myapp


5. Start Laravel Development Server

php artisan serve

Your application will be available at:

http://127.0.0.1:8000


6. Configure Environment File

APP_NAME="My Laravel App"
APP_ENV=local
APP_KEY=base64:randomKeyHere
APP_DEBUG=true
APP_URL=http://127.0.0.1:8000 DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=my_database DB_USERNAME=root DB_PASSWORD=

You have successfully installed Laravel! You can now start building your application by creating routes, controllers, and views.

Comments