Install & Configure Laravel 12 from Scratch – Full Beginner Tutorial
Laravel 12, released in February 2024, introduces a range of enhancements aimed at improving performance, developer experience, and modern PHP compatibility. Whether you're building APIs, web applications, or real-time apps, Laravel 12 continues to provide elegant solutions and developer-friendly tooling.
Here’s a look at the most notable features and updates in Laravel 12.
Table Of Content
1 Prerequisites
Before installing Laravel 12, ensure you have the following prerequisites installed on your system:
1. PHP ≥ 8.2
Laravel 12 requires PHP version 8.2 or higher.
Check with:
php -v
If PHP is not installed, install it using Homebrew (macOS), apt/yum (Linux), or use tools like XAMPP, Laragon, or WampServer on Windows.
You can use MySQL, PostgreSQL, SQLite, etc.
For development, MySQL is the most commonly used.
4. Node: npm uses for frontend manage its dependencies. 5. Web Server: Apache or Nginx is recommended.
2 Introduction
Here's a detailed step-by-step guide to install Laravel 12, even if you're fairly new to Laravel or PHP development. This will take you through setting up your environment, installing Laravel, and running your first app.
3 What's New in Laravel 12?
1. No More Model fillable or guarded by Default
Laravel 12 encourages using form requests and data transfer objects (DTOs) for security instead of relying on fillable or guarded.
2. Controller Route Defaults Removed
Default route values like ->defaults('_controller', ...) are no longer added automatically.
You define only what you need, keeping routes cleaner.
3. Faster Route Compilation
Routes now compile faster thanks to internal improvements — better performance for large apps.
Make sure the database exists before running migrations.
Run Migrations (Optional)
If you want to create the default tables Laravel provides:
php artisan migrate
5 Folder Structure
app/
Holds the core application code:
Console/ - Artisan commands
Exceptions/ - Custom exception handling
Http/ - Controllers, middleware, requests
Models/ - Eloquent models
Providers/ - Service providers
This is where most of your custom logic lives.
bootstrap/
Contains the app.php file which bootstraps the framework. The cache/ folder stores compiled files for faster loading.
config/
All your configuration files — database, queue, mail, app, etc. Each aspect of Laravel is configurable here.
database/
Organized into:
migrations/ - Schema definition files
factories/ - Model factories for testing and seeding
seeders/ - Seed classes to populate your database
public/
The web server points here. It contains the index.php front controller and assets like images, CSS, and JavaScript.
resources/
Where your frontend lives:
views/ - Blade templates
css/, js/ - Frontend assets (with Laravel Mix or Vite)
lang/ - Optional language files
markdown/ - If using markdown-based notifications
routes/
Contains all your route definitions:
web.php - Routes for web (session/cookie)
api.php - Stateless API routes
console.php - Artisan commands
channels.php - Broadcast channel routes
storage/
Used for file storage:
app/ - Local files
framework/ - Cached views, sessions, etc.
logs/ - Application logs
vendor/
Composer-managed dependencies. You don’t edit this — it's managed automatically.
Other Key Files
artisan - CLI tool for managing Laravel
composer.json - PHP dependency list
package.json - JS dependencies (for Vite/Mix)
6 Run Laravel Server to Test the App
Start your server with:
php artisan serve
7 Conclusion
Laravel 12 continues the framework’s tradition of thoughtful evolution — embracing modern PHP features, enhancing the developer experience, and offering first-party tools for building real-time applications. Whether you're a seasoned developer or just getting started, Laravel 12 offers plenty to get excited about.
Thinking about upgrading or starting a new project with Laravel 12? Now’s a great time.