An Introduction to Laravel 5.5


Posted On: Mar 06, 2023

An Introduction to Laravel 5.5


Check What's New in Laravel 5.5

In this tutorial, we are going to cover below topic’s


Laravel 5.5 is the latest stable version of Laravel framework, released on August 30, 2017. It is the next long-term support (LTS) version of Laravel after 5.1 that is going receive bug fixes for two years, and security fixes for the next three years.

Laravel 5.5 is an enhancement in 5.4 and comes with new features like Collection Dumping, Package Auto-discovery, queued job chaining, React front-end presets, renderable mailable and many more that make development more enjoyable and easier.

In this article, we are going to explore all-new features of Laravel 5.5.

Laravel Package Auto-Discovery :Automated Package discovery

In prior versions of Laravel, installing a package will several additional steps such as after installation registering every new package in providers and facade array of config/app.php file.

Now, with Laravel 5.5 Laravel Package Auto-Discovery feature will automate this tasks for you . It will automatically register your package facades and service providers

Lets see an example by installing barryvdh/laravel-debugbar package.

Installing a Package in Laravel

To install this package change your PWD(present working directory) on the terminal to Laravel root folder by running cd your-directory and running below command

composer require barryvdh/laravel-debugbar

Once package installation succeeds, just reload you web app on the browser. What you are seeing the debug bar is available to your application without doing any additional configuration. Actually, this magic is done by Laravel Package Auto-Discovery.

Enable Package Auto-Discovery, package developer just have to add their service providers and facades to their package's composer.json file like below:

"extra": {
   "laravel": {
            "providers": [
            "aliases": {
                "Debugbar": "Barryvdh\\Debugbar\\Facade"

New Frontend Presets: Added support for React and bootstrap.

In prior versions of Laravel, only Vue scaffolding is included, In Laravel 5.5 new Frontend Presets options are available for bootstrap and React including Vue. In the fresh installation of Laravel 5.5 you can swap your Vue scaffolding to React scaffolding using the artisan preset command.

php artisan preset react

You can also preset none command to remove the JavaScript and CSS framework scaffolding completely from the application.

php artisan preset none

Renderable Mailable: Test your emails directly on Browsers

Renderable Mailables feature of Laravel 5.5 allows you to render your email contents on browsers.It helps you test your email contents on browsers rather testing the email view on test email servers. Mailables can now be returned directly from routes, allowing you to quickly preview your mailable's designs in the browser:

Route::get('/mailable', function () {
    $user= App\User::find(1);

    return new App\Mail\WelcomeMail($user);

When you call above route in your browser. It will simply render the "WelcomeMail" contents on the browser.

Auto-Registration of Console Command

In Laravel 5.5 you don't need to manually add a newly created command in $command property of your Console kernel. Now this task is done automated by Laravel. A new method load is called from commands method of your kernel which scans new command from commands directory and registers them for you. /p>

 * Register the commands for the application.
 * @return void
protected function commands()

    // ...

"Sticky" Database Connections

A new option "Sticky" is added in Database configration of laravel that allow immediate reading of records that have been written to the database during the current request cycle.This is an optional option.

Two new route methods Route::redirect and Route::view were introduced

Route:: redirect method is used when you need to define a route that redirects to another URI. This method provides you to provide a convenient shortcut to perform this type of tasks without defining a full route or controller.
Now you can perform a simple redirect like below

Route::redirect('/abc', '/xyz', 301);

Route::view method simply return a view from Routes.Like Route:: redirect method you don't need to define a full route or controller to return a view.

Route::view('/home', 'home');

Blade Improvements : Defining custom conditional directives using Blade::if method

A new blade method Blade::if is introduced in Laravel 5.5 that allows you to quickly define custom conditional directives in Laravel using Closures.You can define your custom conditional directives in the boot method of our AppServiceProvider.

//In app/Providers/AppServiceProvider.php

use Illuminate\Support\Facades\Blade;

Blade::if('isLoggedIn', function () {
    return auth()->check() ;

// views files

    <a href="{{ route('user.logout') }}">Logout </a>
   <a href="{{ route('login') }}">Login </a>

Queued Job Chaining: Controlling your Queued Job Behaviour.

If you want to run a list of queued jobs in a sequence. If any of job in the sequence is failed then rest of jobs will not then Queued Job Chaining feature of Laravel helps you to do so. To execute a queued job chain, you may use the withChain method on any of your dispatchable jobs:

    new InstallNginx,
    new InstallPhp

Read More from

    Please Login or Register to leave a response.

    Related Articles