//New Features in Laravel LTS 5.5
New Features in Laravel LTS 5.5
The Laravel community has been eagerly awaiting the release of Laravel 5.5, as Taylor Otwell mentioned on Twitter. This version is anticipated because Laravel 5.5 will be the second LTS version after Laravel 5.1, the first LTS version, which will reach its end of support in July.
LTS stands for “Long Term Support,” meaning that LTS versions will receive two years of bug fixes and three years of security updates. During the support period of an LTS version, Laravel’s team will continue working hard to provide updates for you. After this period, you should upgrade to a newer version.
Current LTS Version:
- Laravel LTS 5.1
- https://laravel.com/docs/5.1
- PHP > 5.6
Latest LTS Version:
- Laravel LTS 5.5
- https://laravel.com/docs/5.5
- PHP > 7.0
Changes in 5.5:
- Headless Chrome testing: compatible with Laravel Dusk 2.0.0.
- BelongsToMany in Eloquent changes the order of parameters, applying pivot tables.
- $dispatchesEvents property in Eloquent.
- $pivotParent property in Eloquent.
- $exists property of model remains true when using soft delete.
- Added withCount(‘foo as bar_count’) function with alias support for field names.
- Exception content can now be formatted in JSON output.
- Request utility functions change behavior for has(), only(). Removed intersect() function.
- request($key) function no longer accepts nested keys like ‘foo.bar’; use request()->input($key) instead.
- Pass variables to views using dynamic function names view($viewName)->withMyVariable($value), in the view, it will be referred to as $myVariable.
- Validator functions are now public instead of protected.
- A new routes folder outside the app for defining routes of the application, previously routes were in app/Http/routes.php.
Core functions integrated in 5.5:
- Middleware group, separated for different use cases.
- Responsable interface -> format an object like a Response in the Controller.
- Rule Object -> Create validation rules more dynamically using classes.
- Casting fields in the Pivot model.
- Custom directives for Blade’s if expressions to write shorter.
- Dump() or dd() can now be used in between collection operations without interrupting the application, dump() and dd() become functions of the collection.
- Automatically inject Provider and Facade declarations when installing a package, as those details are declared in the package’s JSON.
- The error debugging interface returns to the intuitive style seen in Laravel 2.
- Added two new exception throwing functions throw_if() and throw_unless() to make the code easier to read.
- Validate data more easily directly in the Controller and return the validated values immediately.
- Improved error screen when debug is off (with minor changes).
- Customizable Exception Reports.
- Ready-made presets for web apps, compatible with Bootstrap and Vue.js.
- The migrate command now includes a refresh option, supporting rollback and rerunning existing migration scripts -> Helping rebuild the DB faster in test environments.
- Added support for email templates, compatible with Mailables.
- Support for rendering email templates in the browser, compatible with Mailables.
- Confirmation prompt when running vendor:publish to check the Providers being used.
Nhựt Tân (Summary)