What is Laravel 12

Laravel 12 is the latest major release of the Laravel PHP framework, built for modern, high-performance web applications. It introduces a restructured project layout, enhanced query and ORM features, asynchronous caching, AI-assisted debugging, and improved developer tools for faster and more secure development.
Laravel Versions and Support Timeline
Each Laravel release receives bug fixes for 18 months and security fixes for 2 years. This predictable cycle ensures applications remain stable and secure:
| Version | PHP Support | Release Date | Bug Fixes Until | Security Fixes Until |
|---|---|---|---|---|
| 9 | 8.0 – 8.2 | Feb 8, 2022 | Aug 8, 2023 | Feb 6, 2024 |
| 10 | 8.1 – 8.3 | Feb 14, 2023 | Aug 6, 2024 | Feb 4, 2025 |
| 11 | 8.2 – 8.3 | Mar 12, 2024 | Sep 3, 2025 | Mar 12, 2026 |
| 12 | 8.2 – 8.3 | Q1 2025 | Q3 2026 | Q1 2027 |
1. New Application Structure: Cleaner and Organized
Laravel 12 simplifies the project structure for faster navigation:
- app/Models is optional: Models can live directly in
app/. - Config files centralized: All configuration now in
config/*. - Routes grouped by type: Separate folders for API, web, and console routes.
Before (Laravel 11): app/ ├── Console/ ├── Exceptions/ ├── Http/ │ ├── Controllers/ │ └── Kernel.php routes/ ├── web.php ├── api.php After (Laravel 12): app/ ├── Http/ │ └── Controllers/ ├── Models/ # Optional └── Kernel.php routes/ ├── web/ │ └── web.php ├── api/ │ └── v1.php # Built-in API versioning
2. Advanced Query Builder: nestedWhere()
Nested conditions are simpler with nestedWhere():
// Before Laravel 12
Order::where(function ($q) {
$q->where('status', 'pending')
->orWhere(function ($q) {
$q->where('amount', '>', 100)
->where('priority', 'high');
});
})->get();
// After Laravel 12
Order::nestedWhere(function ($q) {
$q->where('status', 'pending')
->orWhere('amount', '>', 100)
->where('priority', 'high');
})->get();
3. Stronger Security: secureValidate()
Secure password policies are enforced automatically:
// Before
$request->validate([
'password' => ['required', 'min:12', 'regex:/[A-Z]/', 'regex:/[0-9]/']
]);
// After
$request->secureValidate(['password' => 'required|secureValidate']);
4. Native GraphQL Support for APIs
Laravel 12 supports first-party GraphQL integration, making API development faster and cleaner. You can define schemas and query endpoints without third-party packages.
5. AI-Powered Debugging: debug()
Debugging is now smarter with real-time AI suggestions, including contextual fixes for common errors.
debug($product->load('reviews'));
// Outputs the product with reviews + SQL query log
6. Asynchronous Caching
Cache heavy operations without blocking user requests:
// Before
$topProducts = Cache::remember('top-products', 3600, function () {
return Product::popular()->get();
});
// After
$topProducts = Cache::async()->remember('top-products', 3600, function () {
return Product::popular()->get(); // Runs in background
});
7. Real-Time Features: WebSocket Support
Build live features like chat or dashboards without external services:
php artisan websocket:serve
class ChatMessage implements ShouldBroadcast {
public function broadcastOn() {
return new Channel('room');
}
}
8. Smarter Artisan CLI
Interactive commands reduce boilerplate and speed up development:
php artisan make:controller ❓ Controller type? > API ❓ Generate CRUD? > Yes ✅ Controller created at app/Http/Controllers/Api/UserController.php
9. Enhanced Eloquent ORM
Conditional eager loading, filtered relationships, and constraints simplify database interactions:
User::withFiltered('orders', ['status' => 'completed'])->get();
10. Job & Queue Management
Dynamic prioritization and delayed retries improve background task orchestration:
dispatch(new SendInvoice($invoice))->prioritize('high');
11. Modern DevOps Integration
Automated deployment commands like deploy:prepare streamline cache clearing, migrations, and asset compilation.
Deprecated Functions in Laravel 12
- Removal of
restore()in global scopes. - Route helper supports only string-based routes.
- Array-based relationship definitions in models are deprecated.
- Validation rule
samereplaced withcompare. - Old helper functions like
parse_url()replaced withUrlfacade.
Conclusion:
Laravel 12 delivers a faster, more secure, and developer-friendly framework. From improved performance and asynchronous caching to AI-assisted debugging and WebSocket support, it equips developers to build scalable modern applications efficiently.
Related Answers
Still need help?
Talk to our Laravel experts
We've handled GDPR/CCPA compliance for dozens of EU & US Laravel.
