Laravel 12.39 brings focused improvements that enhance developer experience without breaking anything. The standout additions are the @hasStack Blade directive, middleware filtering for route:list, and a set of type safety and testing fixes that matter in production.
What's New in Laravel 12.39
- @hasStack Blade Directive — Conditional stack rendering
- Route List Middleware Filtering — Filter routes by middleware from the CLI
- Type Safety Enhancements — Better PHP type hints across the framework
- Parallel Test Support — WithCachedConfig now works with parallel testing
- Symfony 7.4 Compatibility — Updated Request::getAcceptableContentTypes()
1. @hasStack Blade Directive
The new @hasStack directive lets you conditionally render wrapper elements only when a Blade stack has content. Before this, stacks could leave behind empty <div> or <script> wrappers even when nothing was pushed to them.
This ensures the CDN script tag only renders when the stack actually has content — cleaner HTML, no wasted requests.
Practical use cases
- Conditional asset loading — only load Stripe.js on checkout pages
- Dynamic meta tags — only render the meta block when content exists
- Reusable layouts — components that gracefully handle empty slots
Real-world example: E-commerce checkout
Use @hasStack to load Stripe's JS only on pages that push to the checkout-scripts stack — keeps every other page free of unnecessary third-party scripts.
2. Route List Middleware Filtering
The route:list command now accepts a --middleware flag, letting you filter routes by the middleware they use. This is genuinely useful for security audits and debugging large applications.
This is particularly useful for checking which routes are protected by authentication, auditing rate-limited endpoints, and generating API documentation from the CLI.
3. Type Safety & Performance Improvements
Enhanced type hints
- ResourceCollection —
$collectionproperty is now properly nullable - Http::pool() — better type safety for concurrent HTTP operations
- Exception handling — improved error message summarisation
Testing improvements
- Parallel test support —
WithCachedConfignow works correctly with parallel testing - Test generator —
--forceflag now carries through tomake:test - SQLite fixes — resolved stale connection issues in
RefreshDatabase
Framework integration
- Symfony 7.4 compatibility — updated
Request::getAcceptableContentTypes() - Factory improvements — better array cast handling
- Application builder — enhanced exception handling
4. Upgrading to Laravel 12.39
The upgrade is straightforward — 12.39 is fully backward compatible. Just update your dependencies and run your test suite:
Check the official changelog for the full diff, though no breaking changes are expected for standard applications.
5. What's Coming in Laravel 12.40
The community is already discussing what's next. The most anticipated additions include time interval helpers for more expressive date manipulation, enhanced queue pausing/resuming, instant column additions to migrations, and PostgreSQL full-text search support. Nothing is confirmed until it ships, but these are the PRs getting the most attention.
Conclusion
Laravel 12.39 is a focused quality-of-life release. The @hasStack directive solves a real template cleanliness problem, middleware filtering in route:list improves debugging workflows, and the type safety fixes reduce runtime surprises. Worth upgrading — and painless to do so.
For more on optimising your Laravel app, see the Laravel Performance Optimization guide and REST API Best Practices.