Laravel 5.4 is now available. Let's check out its new features/changes, and learn how to upgrade to Laravel 5.4.

laravel 5.4 new features

Here are the official changes and new features:

Two new Middleware

We have 2 new middleware: TrimStrings and ConvertEmptyStringsToNull.

  • Trim Strings middleware: automatically trim all the request data.

  • ConvertEmptyStringsToNull: automatically convert all strings to null.

Laravel Elixir will be renamed to Laravel Mix

The next version of Laravel Elixir will be built on Webpack, and it has a new name: Laravel Mix!

Meet the new Laravel Dusk

Laravel Dusk

Dusk is a new browser testing tool of Laravel. Now we can use Dusk to test everything, including Javascript applications (Ajax loading, jQuery, etc.). This is the most awaited feature of Laravel 5.4!

Use any class as Facade

We can use any class as a Facade in Laravel 5.4

Better Vue.js 2 support

Laravel 5.4 supports Vue 2 from the ground. if you love Vue, you're gonna love Vue 2 more!

Use Markdown in our emails

Loving Markdown? With Laravel 5.4, we can use Markdown in our emails. Awesome!

JSON based language files

We can be able to use JSON as our language files. This is great and very useful for multi-language projects.

Add components and slots to our Blade templates

We can add components and slots to our template in Laravel 5.4. Basically, this feature allows us to build reusable HTML elements for our app. If you're working with ReactJS, Angular 2 or Vue; you're right at home.

Minor route improvements

Route system will be enhanced. Route caching system is improved.

Now we can define a named route at the beginning:

Route::name('blog')->get('blog/{id}/', function ($id) {
});

Upgrade to Laravel 5.4

You can easily upgrade to Laravel 5.4 by following this guide:

https://laravel.com/docs/5.4/upgrade

Basically, you can just update your laravel/framework dependency to **5.4.* in your composer.json** file.

Find:

"laravel/framework": "5.3.*",

Change to:

"laravel/framework": "5.4.*",

And then run this command:

composer update

Please note that Elixir and some features have been changed. So if you still need some old features, don't upgrade yet.

Laravel 5.4's release notes

Learn more about all new features at:

https://laravel.com/docs/5.4/releases

Source Code

Laravel 5.4's source code is now available at:

https://github.com/laravel/framework

Final thoughts

Awesome! Let's start building your apps with Laravel 5.4!

Note: Learning Laravel 5 book, Laravel 5 Cookbook and Angular 2 Book are updated to support Laravel 5.4!


This post is submitted by Jason Dake