How to Install Laravel 12 – Step-by-Step Guide
#Laravel 12 #Laravel Installation #PHP Framework #Web Development #Laravel Tutorial #Composer #Laravel for Beginners

How to Install Laravel 12 – Step-by-Step Guide

Laravel is one of the most popular PHP frameworks for building modern web applications. With clean syntax, powerful features, and a strong ecosystem, Laravel 12 makes development even more enjoyable. In this blog, we’ll walk through **how to install Laravel 12 step by step**, from system requirements to running your first Laravel application.

1. System Requirements

Before installing Laravel 12, make sure your system meets the following requirements:

  • PHP**: 8.2 or higher
  • Composer**: Latest version
  • Web Server**: Apache / Nginx (optional for local development)
  • Database**: MySQL, PostgreSQL, SQLite, or SQL Server

Required PHP Extensions

Ensure these PHP extensions are enabled:

  • OpenSSL
  • PDO
  • Mbstring
  • Tokenizer
  • XML
  • Ctype
  • JSON
  • BCMath
  • Fileinfo

You can check your PHP version using:

 php -v 

 

2. Install Composer

Composer is a dependency manager for PHP and is required to install Laravel.

Check if Composer is Installed

 composer -V 

If Composer is not installed, download it from:

👉 https://getcomposer.org

After installation, restart your terminal.

3. Install Laravel 12

There are **two recommended ways** to install Laravel 12.

Method 1: Using Composer Create-Project (Recommended)

Run the following command:

 composer create-project laravel/laravel my-project

This will:

  1. Download Laravel 12
  2. Install all dependencies
  3. Create a new project folder named `my-project`

Move into your project directory:

 cd my-project

Method 2: Using Laravel Installer

If you are using method 1 then you can skip method 2 First, install the Laravel installer globally:

composer global require laravel/installer

Make sure Composer’s global `vendor/bin` directory is in your system PATH. Then create a new Laravel project:

laravel new my-project

4. Configure Environment File

Laravel uses an .env file for environment configuration.

Duplicate the example file (if not already created):

cp .env.example .env

Generate the application key:

php artisan key:generate

This key is essential for security and encryption.

5. Database Configuration

Open the .env file and update your database details:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel12
DB_USERNAME=root
DB_PASSWORD=

Save the file after making changes.

6. Run Database Migrations

To create default tables, run:

php artisan migrate

This will set up tables like users, password_reset_tokens, and more.

7. Start the Development Server

Laravel comes with a built-in development server.

Run the following command:

php artisan serve

You'll see output like:

Server running on http://127.0.0.1:8000

Open this URL in your browser 🎉

8. Verify Laravel 12 Installation

If the installation is successful, you should see:

  • Laravel welcome page
  • Laravel version mentioned in the footer or via:
php artisan --version

9. Common Issues & Fixes

❌ Permission Issues (Linux / macOS)

chmod -R 775 storage bootstrap/cache

❌ Missing APP_KEY

php artisan key:generate

❌ Composer Memory Error

COMPOSER_MEMORY_LIMIT=-1 composer install

10. What's Next?

Now that Laravel 12 is installed, you can:

  • Create routes in routes/web.php
  • Build controllers and models
  • Use Blade or APIs
  • Install authentication (Breeze / Jetstream)
  • Connect frontend frameworks like Vue or React

Conclusion

Installing Laravel 12 is simple and straightforward if your system meets the requirements. With Composer and Artisan, you can get a powerful web application up and running in minutes.

Happy coding with Laravel 12 🚀

×
MLM PLAN
×
×