How to Install Laravel 12: Step-by-Step Beginner Guide

Laravel is one of the most popular PHP frameworks for building modern web applications. In this tutorial, you will learn how to install Laravel 12 from scratch, verify the installation, and run your first Laravel application using official and recommended methods.

System Requirements
Laravel 12 requires a modern PHP environment with specific extensions enabled to function correctly. These requirements ensure optimal performance and security.
- PHP 8.3 or higher
- Composer (PHP dependency manager)
- OpenSSL PHP Extension
- PDO PHP Extension
- Mbstring, Tokenizer, XML, Ctype, JSON extensions
Check PHP Version
php -vStep 1: Install Composer
Composer is required to manage Laravel dependencies. If Composer is not installed on your system, use the following commands to install it globally.
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
composer --versionStep 2: Install Laravel 12
The recommended way to install Laravel 12 is by using Composer’s create-project command. This method downloads the framework along with all required dependencies.
composer create-project laravel/laravel my-laravel-appVerify Laravel Installation
cd my-laravel-app
php artisan --versionStep 3: Environment Configuration
Laravel uses an .env file to manage environment-specific configuration such as database credentials and application keys.
cp .env.example .env
php artisan key:generateStep 4: Run Laravel Development Server
Laravel includes a built-in development server that allows you to run your application locally without additional setup.
php artisan serveLaravel Project Structure Overview
After installation, Laravel creates a well-organized directory structure that helps developers maintain clean and scalable applications.
| Directory | Purpose |
|---|---|
| app/ | Core application logic such as controllers and models |
| routes/ | All application route definitions |
| resources/ | Views, Blade templates, and frontend assets |
| database/ | Migrations, factories, and seeders |
| storage/ | Logs, cache, and compiled files |
storage and bootstrap/cache directories to avoid runtime errors.Conclusion
You have successfully installed Laravel 12 and run your first application. With its elegant syntax and powerful features, Laravel 12 is an excellent choice for building scalable and secure PHP applications. From here, you can explore routing, controllers, databases, and API development.
$ share --platform
$ cat /comments/ (0)
$ cat /comments/
// No comments found. Be the first!


