Categories: LaravelLaravel 6

Laravel 6 Release New Features and Updates

As on September 3rd, 2019 Laravel Framework development team has officially announce the release of new version of laravel which Laravel 6 and it is LTS (Long-term support).

New laravel 6 is now available to everyone along with the documentation about release notes and upgrade guide from 5.8 to 6, upgrading from laravel 5.8 to 6 will take around one hour depending on feature your using into your existing laravel 5.8 application.

This new release of the Laravel framework (laravel/framework) using Semantic Versioning. Also, this release includes compatibility with Laravel Vapor, it has improved authorization responses, job middleware, lazy collections, sub-query improvements, along with many other major improvements.

Recommended – Develop Exclusive Laravel 6 CRUD Application with Input Validations

Here is the list of the new features included in Laravel 6:

New LTS Release

As I told in the beginning of this tutorial, Laravel 6 is LTS release meaning it has long term support policy included, it will support bug fixes for 2 years until September 3rd, 2021 and security fixes for 3 years until September 3rd, 2022.

Laravel 6 has provided the longest time of support and maintenance possible, and for general releases bug fixes are only support for 6 months and security fixes for 1 year.

Here’s the release table with versions and dates:

VersionReleaseBug Fixes UntilSecurity Fixes Until
6.0 (LTS)Sep 3rd, 2019Sep 3rd, 2021Sep 3rd, 2022
5.8Feb 26th, 2019Aug 26th, 2019Feb 26th, 2020
5.7Sep 4th, 2018Mar 4th, 2019Sep 4th, 2019
5.6Feb 7th, 2018Aug 7th, 2018Feb 7th, 2019
5.5 (LTS)Aug 30th, 2017Aug 30th, 2019Aug 30th, 2020
5.4Jan 24th, 2017Jul 24th, 2017Jan 24th, 2018
5.3Aug 23rd, 2016Feb 23rd, 2017Aug 23rd, 2017
5.2Dec 21st, 2015Jun 21st, 2016Dec 21st, 2016
5.1 (LTS)Jun 9th, 2015Jun 9th, 2017Jun 9th, 2018
5.0Feb 4th, 2015Aug 4th, 2015Feb 4th, 2016

Semantic Versioning

From now Laravel framework package and all it’s upcoming releases will follow the semantic versioning standards according to the laravel documentation. It will make the framework release more consistent with the first-party Laravel packages which already where following this standard.

Improved Authorization Responses

With laravel older versions like 5.* it was little bit difficult to provide custom error messages while implementing authorization process, now Laravel 6 has come up with Gate::inspect method which is going to provide the authorization policy’s response, here how we can provide custom response message to the laravel authorization process.

Example of Laravel Custom Authorization Responses:

$response = Gate::inspect('view', $flight);

if ($response->allowed()) {
    // User is authorized to view the flight...

if ($response->denied()) {
    echo $response->message();

Job Middleware

As name suggest job middleware are basically, jobs those are going to run through middleware.

So we can create a job which we want to run through middleware and we can specify the middleware into the job using middleware() method, like showing below:

use App\Jobs\Middleware\MyCustomMiddleware;

// a middleware method for job class 
public function middleware()
     return [new MyCustomMiddleware];

You can also specify middleware when we dispatch the job, here is simple example:

MyJob::dispatch()->through([new MyCustomMiddleware]);

Recommend – How to Create Configure and Use Laravel Custom middleware in Laravel 5.8

Improved Exceptions Page Via Ignition

Laravel 6.0 comes with the Ignition, Ignition will provide new beautiful, more developer friendly UI and improved Exception page.

Here is the example of new Exception page:

Example of new Exceptions Page Via Ignition in Laravel 6

Lazy Collections

Lazy collections is going to be an outstanding feature while working with extensive collections of data, including Eloquent model collections.

New Illuminate\Support\LazyCollection class leverages PHP’s generators to keep memory low while working with large datasets.

For example, if we needs to process a multi-gigabyte, so Instead of reading it at once into memory lazy collections will allow us to keep only a small part of the file in memory at a given time.

You can learn more about lazy collection to increase speed and performance of laravel application – Practical Useful Examples of Using Laravel 6 Lazy Collection Class

Eloquent Subquery Enhancements

Laravel 6.0 comes with new enhancements and improvements to database subquery in Eloquent ORM.

So with laravel 6 we can basically use models class names to execute queries to the database.

Here is how we can apply sub queries using model class:

return Destination::addSelect(['last_flight' => Flight::select('name')
    ->whereColumn('destination_id', '')
    ->orderBy('arrived_at', 'desc')

Recommend – Complete guide of using Laravel 6 Eloquent Subquery Enhancements

Laravel UI

The frontend scaffolding which was included in Laravel 5.x releases is now extracted into a separate laravel/ui Composer package. This allows first-party UI scaffolding to be iterated on separately from the primary framework.

So important note here, no Bootstrap or Vue code is present in default laravel 6 framework scaffolding, and the make:auth command has been extracted from the framework as well.

If you want the Traditional Bootstrap/Vue/ scaffolding, you can do tthat using following command:

composer require laravel/ui
php artisan ui vue --auth

Get complete steps on using Laravel UI package to – Configure Bootstrap Vue React in Laravel 6 with make auth

Laravel Vapor Compatibility

Laravel 6 comes with compatibility with Laravel Vapor, Vapor provides auto-scaling serverless deployment platform for Laravel.

Vapor abstracts the complexity of managing Laravel applications on AWS Lambda, as well as interfacing those applications with SQS queues, databases, Redis clusters, networks, CloudFront CDN, and more.

Want to create new Laravel 6 application?

From now with Laravel CLI you will be able to create a new Laravel 6 application, as showing below:

laravel new my-app
Laravel 6 Welcome screen

Here are list of documentation guide which you can check from Laravel official website

Enjoy creating awesome applications with laravel 6.

Browser all available tutorial in Laravel here on iTech Empires – Laravel Tutorials

Yogesh Koli

Software engineer & Blogger lives in India, has 6+ years of experience working with the front-end and back-end web app development.

Recent Posts

Complete guide of using Laravel 6 Eloquent Subquery Enhancements

Learn How to use laravel frameworks new improved feature called Eloquent Subquery and get example…

8 months ago

3 Useful examples of using Array Map function in PHP – Best Practices

Learn how to use php array map function with easy and essential tutorial to modify…

8 months ago

Working with PHP Array Filter Function – Best Practices

Learn how to use php array filter function with easy and essential tutorial to filter…

8 months ago

How to add Access Modifiers with Constructor Parameters in TypeScript

Want to know how to refactor your Typescript class, Learn here utilising Typescript of the…

8 months ago

What is Access Modifiers and how to use Access Modifiers in TypeScript ?

What is Access Modifiers in typescript, how to use Access Modifiers, when to use them,…

9 months ago

Top 10 Super Useful Packages to Improve Laravel applications in 2019

This tutorial provide ultimate list of package those are top 10 on packagist and super…

9 months ago