Skip to content

Laravel 5.5: What’s New?


Despite being an open-source PHP framework, Laravel has constantly evolved to meet emerging trends in web application development. The latest LTS (Long Term Support) version of Laravel was officially released in August. Laravel 5.5 enables developers to accelerate web application development by leveraging PHP 7.

At the same time, it includes several new features, improvements, and bug fixes to make custom web application development easier. Developers can automate the Laravel 5.4 to Laravel 5.5 migration process by using third party tools like Laravel 5.5 Shift.But it’s also important for PHP developers to understand the new features and changes in Laravel 5.

Overview of New Features and Changes in Laravel 5.5

Automatic Package Discovery

When working with an older version of Laravel, developers have to go the extra mile to add service providers to the application configuration file and register the relevant facades. But Laravel 5.5 has the ability to automatically detect service providers and facades. Service providers and facades are also recorded without manual intervention.

Resource Classes

While working with Laravel 5.5, developers can use resource classes to speed up API development. You no longer need to use an additional layer of transformation between Eloquent models and JSON requests. Resource classes make it easy for programmers to convert models and collections of models. in JSON without using transformation layers.

Automatic Registration of Console Commands

With older versions of Laravel, the programmer had to manually list custom commands in the console kernel via the $commands property. Laravel 5.5 allows developers to register custom commands more efficiently by invoking the new loading method of kernel commands. Once the load method is invoked, it searches a specified directory for console commands and automatically logs the console commands found in the directory.

New Frontend Preset Options

The latest version of Laravel supports basic Vue scaffolding. But it allows developers to take advantage of a number of new interface presets. Developers can run preset commands to switch from Vue scaffolding to React scaffolding. You can also use the default none for remote JavaScript. and CSS framework for the web application. However, the developer can only use these frontend presets in new Laravel applications.

Validation Rule Objects

Laravel 5.5 allows developers to more efficiently add custom validation rules to a web application using validation rule objects. A developer can create new validation rules in the app/Rules directory simply by running a new Artisan command. But each object rule can only have two methods – Passes and Messages. The “Passes” method gets the name and value of the attribute, while the “Messages” method returns the validation error message.

Time Based Job Attempts

Laravel allows developers to set the number of times a job or task must be tried before it fails. Laravel 5.5 allows developers to add a time period to the number of job attempts. A developer now has the ability to set the time to pause work attempts. Therefore, a job can be attempted within a certain period of time.

Renderable Mailables

Older versions of Laravel don’t provide features to make email design testing easier. Therefore, developers have to rely on third-party tools like Mailtrap to test email layouts. Laravel 5.5 makes it easier for users to test email layouts by sending emails directly to the browser. It even returns emails directly from routes.

On-Demand Notifications

With Laravel 5.5, Laravel developers have the option to have the app send notifications to people who are not saved as users. You can call the new Notification::route method to send on-demand notifications to people by specifying custom routing information for ad hoc notifications.

Consistent Exception Handling

When working with older versions of Laravel, developers need to adapt the format of JSON validation error responses to specific places in the PHP framework. Laravel 5.5 allows developers to maintain consistency in handling validation exceptions and avoid customizations. Developers can even handle the JSON message formatting validation error with a single method.

Renderable and Reportable Exceptions

In addition to maintaining consistency in exception handling, Laravel 5.5 allows developers to define a rendering method directly for exceptions. Therefore, developers can include custom response rendering logic in exceptions without injecting conditional logic into the event handler. You even have the ability to customize the reporting logic for each exception.

Cache Lock

Laravel 5.5 ships with improved Redis and Memcached cache drivers capable of acquiring and releasing atomic locks. Developers can take advantage of these improved cache drivers to acquire arbitrary locks by calling a simple method. You can use the simple method to get a lock that prevents multiple processes from trying the same task before the application performs a specific task.

New Routing Methods

The updated version of Laravel makes it easier for developers to define routes by providing several new methods. Developers can use Route::redirect to easily define a route that redirects to another URI. Similarly, the Route::view method makes it easier for programmers to define a route as a view. Programmers can avoid defining a full path by using the shortcuts provided by these methods.

New Database Configuration Option

With Laravel 5.5, developers can take advantage of a new database configuration option called Sticky while configuring read/write database connections. As an optional value, sticky facilitates immediate reading of records written to the database during the current request cycle. In addition, it allows developers to mix read and write connection operations when writing operations to the database are performed during the same request cycle.

Blade Improvements

When using Laravel, developers speed up view generation and rendering with a robust template engine like Blade. The latest version of the PHP framework includes several Blade-related improvements. For example, Laravel allows developers to define custom conditional statements with closures via a new method – Blade::if. Similarly, a developer can more efficiently check a user’s current state using a set of shortcuts: @auth, @guest, @endauth, and @endguest.

Overall, Laravel 5.5 comes with several new features and improvements. These new features make PHP developers more productive and reduce the time and effort required to build custom web applications.