Laravel 6 Is Now Released

Laravel 6 Is Now Released

The Laravel team is proud to announce the release of Laravel 6 and it’s now available to everyone. This release marks the start of the Laravel framework (laravel/framework) using Semantic Versioning. Also, this release includes compatibility with Laravel Vapor, improved authorization responses, job middleware, lazy collections, sub-query improvements, among many other improvements.

Here are some of the new features included in Laravel 6:

Laravel 6.0 Is the New LTS

The release of Laravel 6.0 marks the new LTS version of Laravel, with bugfixes until September 3rd, 2021 and security fixes until September 3rd, 2022. Laravel 5.5 was the previous LTS (with security fixes until August 30th, 2020). Here’s the updated table with versions and dates of the latest versions of Laravel:

Version Release Bug Fixes Until Security Fixes Until
V1 June 2011
V2 September 2011
v3 February 2012
v4 May 2013
5.0 Feb 4th, 2015 Aug 4th, 2015 Feb 4th, 2016
5.1 (LTS) Jun 9th, 2015 Jun 9th, 2017 Jun 9th, 2018
5.2 Dec 21st, 2015 Jun 21st, 2016 Dec 21st, 2016
5.3 Aug 23rd, 2016 Feb 23rd, 2017 Aug 23rd, 2017
5.4 Jan 24th, 2017 Jul 24th, 2017 Jan 24th, 2018
5.5 (LTS) Aug 30th, 2017 Aug 30th, 2019 Aug 30th, 2020
5.6 Feb 7th, 2018 Aug 7th, 2018 Feb 7th, 2019
5.7 Sep 4, 2018 Feb 4th, 2019 Sep 4th, 2019
5.8 Feb 26th, 2019 Aug 26th, 2019 Feb 26th, 2020
6.0 (LTS) Sept 3rd, 2019 Sept 3rd, 2021 Sept 3rd, 2022

Semantic Versioning

The Laravel release notes clarify semantic versioning going forward in Laravel 6.0 and beyond:

The Laravel framework (laravel/framework) package now follows the semantic versioning standard. This makes the framework consistent with the other first-party Laravel packages which already followed this versioning standard. The Laravel release cycle will remain unchanged.

Improved Authorization Responses

Previously it was difficult to provide custom error messages around authorization to end users. Laravel 6 introduces a Gate::inspect method which provides the authorization policy’s response:

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

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

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

Job Middleware

Job Middleware is a feature contributed by Taylor Otwell, which allows jobs to run through middleware:

// Add a middleware method to a job class
public function middleware()
{
     return [new SomeMiddleware];
}

// Specify middleware when dispatching a job
SomeJob::dispatch()->through([new SomeMiddleware]);

The middleware will help you avoid custom logic in the body of your job’s handle() method. Learn more in our post: Job Middleware is Coming to Laravel 6.

Lazy Collections

Lazy collections are a game-changer for working with extensive collections of data, including Eloquent model collections. A new Illuminate\Support\LazyCollection class leverages PHP’s generators to keep memory low while working with large datasets. Check out Lazy Collections documentation for more details on this impressive new feature!

Eloquent Subquery Enhancements

Learn more about Jonathan Reinink’s contributions to subqueries in his post on Laravel News – Eloquent Subquery Enhancements in Laravel 6.0. Also, check out Jonathan’s excellent talk on using subqueries (among other techniques) in his Laracon talk Eloquent Performance Patterns.

Laravel UI

The frontend scaffolding provided with 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.

If you want the Traditional Bootstrap/Vue/ scaffolding, you will run the following command:

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

Learn More

You should now be able to start a new Laravel 6 application with the laravel CLI tool:

laravel new my-app

Here’s a few resources related to Laravel 6 that you should check out: