Laravel 12 Installation Guide: Zero to Production in Minutes

Laravel 12 will simplify its installation process when it releases in Q1 2025. Developers can deploy their applications from scratch to production within minutes. The new version comes packed with features like asynchronous caching and smooth integration with modern tools such as Tailwind CSS 4.0 and Vite 6.0.


Setting Up Your Development Environment

A resilient development environment is the foundation for building Laravel 12 applications.

Installing PHP 8.2+ and Required Extensions

Install PHP 8.2 and the necessary extensions for Laravel 12:

sudo apt-get update

sudo apt-get install -y 
php8.2 
php8.2-cli 
php8.2-common 
php8.2-fpm 
php8.2-mysql 
php8.2-zip 
php8.2-gd 
php8.2-mbstring 
php8.2-curl 
php8.2-xml 
php8.2-bcmath 
php8.2-openssl 
php8.2-json 
php8.2-tokenizer

Configuring Composer for Laravel Installer

composer self-update
composer global require laravel/installer

Restart your terminal after installing the Laravel installer globally.

Setting Up Local Database Server

Laravel 12 supports:

  • MariaDB 10.3+
  • MySQL 5.7+
  • PostgreSQL 10.0+
  • SQLite 3.26.0+
  • SQL Server 2017+

Configure the .env file for MySQL:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=root
DB_PASSWORD=your_password

Installing Laravel 12 Using Composer

composer create-project --prefer-dist laravel/laravel your-project-name "12.x-dev"
# Or using Laravel installer
laravel new your-project-name --dev

Check for hidden files if you see "directory not empty" errors:

ls -lah

Verifying Installation Success

Run the following commands:

cd your-project-name
npm install && npm run build
composer run dev
php artisan --version

Access your application at http://localhost:8000 to see the welcome page.


Configuring Your New Laravel Application

Environment Variables

cp .env.example .env
php artisan key:generate

Maintain separate .env files for different environments: .env.testing, .env.demo, .env.production.

Cache and Session Configuration

Update cache driver in .env:

CACHE_DRIVER=file

Optimize configurations for production:

php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan event:cache

Testing Your Installation

Start the development server:

php artisan serve
# Or specify a different port
php artisan serve --port=9000

Visit http://127.0.0.1:8000 or http://localhost:8000 to see the Laravel 12 welcome page.

Use the built-in health check endpoint at /up to monitor your application:

# Returns 200 for healthy, 500 for errors
curl http://localhost:8000/up

Conclusion

Laravel 12 simplifies installation and provides a reliable foundation for building modern applications. With PHP 8.2+, Composer integration, and the Laravel installer, you can quickly set up your environment, configure databases, caching, and sessions, and start development immediately.

Modern features like asynchronous caching, Tailwind CSS 4.0, and Vite 6.0 integration make Laravel 12 a powerful choice for rapid development. Use the built-in health checks and optimized configurations to ensure smooth production-ready deployments.


Frequently Asked Questions

What is the minimum PHP version required for Laravel 12?+
Can I install Laravel 12 using Composer?+
How do I verify my Laravel 12 installation?+
How do I run the development server in Laravel 12?+
Does Laravel 12 include a health check system?+