Laravel 12 Complete Installation Guide (2025)
Step-by-step instructions to set up Laravel 12 on Windows, macOS, Linux, or Docker Sail — updated for 2025 with Vite, PHP 8.3+, and real-world tips.
Released: 2025
Requires PHP 8.3+
Composer 2.x
Laravel 12 continues to simplify modern PHP development with performance improvements, security updates, and better support for PHP 8.3. In this guide, we’ll cover:
- ✔ Quick installation using Composer, Installer, or Docker Sail
- ✔ Setting up
.envand database - ✔ Running migrations & storage linking
- ✔ Asset compilation with Vite
- ✔ Adding authentication with Breeze/Jetstream
- ✔ Production deployment tips
1. Quick Installation (Composer)
composer create-project laravel/laravel:^12.0 my-app
cd my-app
php artisan serve
Visit http://127.0.0.1:8000
2. Using Laravel Sail (Docker)
curl -s https://laravel.build/my-app | bash
cd my-app
./vendor/bin/sail up -d
Pro Tip: Sail gives you a zero-config PHP/MySQL/Redis setup — no local installations needed.
3. Configure Environment
cp .env.example .env
php artisan key:generate
Update database credentials in .env:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=my_app
DB_USERNAME=root
DB_PASSWORD=secret
4. Database Migration
php artisan migrate
If you just want quick testing, switch to SQLite by setting DB_CONNECTION=sqlite and creating database/database.sqlite.
5. Asset Compilation with Vite
npm install
npm run dev # development
npm run build # production
6. Add Authentication (Optional)
composer require laravel/breeze --dev
php artisan breeze:install blade
npm install && npm run dev
php artisan migrate
7. Production Deployment
- Set
APP_ENV=production,APP_DEBUG=false - Run
php artisan config:cache,route:cache,view:cache - Ensure
storageandbootstrap/cacheare writable
8. Common Errors
- “Class not found” → Run
composer dump-autoload - Permission errors → Check
storage/andbootstrap/cache/ownership - Vite assets missing → Ensure
@vite()tags are included in Blade layout
With this setup, you can confidently launch new Laravel 12 projects in 2025 — faster, cleaner, and production-ready.

0 Comments