What Is New in Laravel 5.5
Laravel 5.5 is a Long Term Support (LTS) release packed with features that streamline development workflows and enhance application robustness.
| Category | Key Additions |
|---|---|
| New Features | Package Auto-Discovery, Custom Exception Rendering, Renderable Mailables, Queued Job Chaining, New Frontend Presets |
| Improvements | Automatic Registration of Console Commands, Better Database Testing, Streamlined Request Validation |
| Developer Experience | New Artisan Commands, dd and dump Methods in Collections, Responsable Interface |
How does package auto-discovery simplify development?
Package auto-discovery removes the need to manually register service providers and facades in the config/app.php file. Packages can now define their configuration in a composer.json file, and Laravel automatically registers them upon installation.
This drastically reduces the boilerplate code required to integrate third-party packages. In practice, it means a cleaner config file and a much faster setup process for new packages.
What is custom exception rendering?
Custom exception rendering allows you to define how specific exceptions are converted into HTTP responses directly within the exception class itself using a render method. This centralizes the response logic instead of having it all cluttered in the Handler.php file.
This is great for API development because you can easily return consistent JSON error responses for different exception types. It makes your exception handling code more organized and maintainable.
How do renderable Mailables and notifications work?
Mailables and notifications can now be returned directly from routes, allowing you to quickly preview their output in the browser. Instead of being forced to send an email to test its design, you can just visit a temporary route to see exactly how it will look.
This is a massive time-saver during development and debugging. You can iterate on email templates instantly without clogging up a mail log or your inbox.
What improvements were made to database testing?
Laravel 5.5 introduced the DatabaseMigrations trait, which now runs migrations once at the beginning of a test suite and then wraps each test in a transaction. This provides a significant speed boost compared to the old method of rolling back and re-running migrations for every single test.
For large test suites, this change can cut minutes off the total test execution time. It's one of those quality-of-life improvements that makes TDD much more pleasant.
FAQ
Is Laravel 5.5 an LTS release?
Yes, Laravel 5.5 is a Long Term Support (LTS) release. This means it received bug fixes for 2 years and security fixes for 3 years from its release date.
How do I turn off package auto-discovery?
You can disable auto-discovery for a specific package by listing it in the "dont-discover" array in your composer.json file. You can also disable it entirely for all packages.
What is the new Responsable interface?
The Responsable interface allows objects to define how they should be converted into HTTP responses. If an object implements this interface and has a toResponse() method, it can be returned directly from a route or controller.
What new frontend presets are available?
Laravel 5.5 replaced the default Bootstrap preset with a new, simpler preset. It also introduced presets for React and Vue, which can be easily scaffolded using the preset Artisan command.
How does queued job chaining work?
The withChain method allows you to specify a list of jobs that should run in sequence after the primary job executes successfully. If any job in the chain fails, the subsequent jobs will not be run.