Provides a list of the new features introduced in Laravel 6.

What's New In Laravel 6
What's New In Laravel 6
September 06, 2019

Laravel - The PHP Framework For Web Artisans is the most popular PHP framework to develop web applications. This post provides a list of the new features introduced in Laravel 6.

Laravel 6 was released on 28th August 2019 with a host of new exciting features including lazy collections, the new default error page Ignition, improved authorization responses, job middleware, and Eloquent subquery enhancements. With the release of Laravel 6, the website also got a fresh look.

It's also an LTS release which means it will get updates and patches for a pre-defined duration with bugfixes until 3rd September 2021 and security fixes until 3rd September 2022.

Lazy Collections

As the feature name suggests, it adds options to lazy load the collections.

From Laravel Docs - The LazyCollection class leverages PHP's generators to allow you to work with very large datasets while keeping memory usage low.

The file example provided at the Laravel Docs makes it pretty much clear to use the LazyCollection class. It makes it easy to perform operations on large datasets by loading a chunk at a time.

Ignition - The default error page

Ignition is the default error page introduced in Laravel 6 which makes debugging exceptions and stack traces better. It shows details about the request, application, user, context, and debug. The debug tab shows queries, logs, and dumps. The Ignition error page can also be installed with Laravel 5 applications.

Improved Authorization Responses

A static method inspect is added to the class Gate to check whether the user is authorized to access the resource. It can be used as shown below.

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

// Allowed
if( $response->allowed() ) {

// User is authorized to access $view1

// Continue with the code

// Denied
if ($response->denied() ) {

// Generate error message
echo $response->message();

Job Middleware

Taylor Otwell introduced the feature Job Middleware to run the job through the specified middleware. The Job Middleware allows wrapping custom logic around the execution of queued jobs, separating the logic from the jobs themselves.

// Add middleware method to job class
public function middleware() {

return [ new MyMiddleware ];

// Dispatch job through middleware
MyJob::dispatch()->through( [ new MyMiddleware ] );

Eloquent Subquery Enhancements

The subqueries for Select, Order By, From are enhanced as explained by Jonathan Reinink.

Laravel UI

The frontend scaffolding provided with the previous Laravel 5.x releases is now extracted into a separate Composer package i.e. laravel/ui.

Laravel Vapor Compatibility

Laravel 6.0 provides compatibility with Laravel Vapor built by Taylor Otwell. Laravel Vapor is an auto-scaling serverless deployment platform for Laravel.

These are the major changes introduced in Laravel 6.

Write a Comment

Click on the captcha image to get new code.
Discussion Forum by DISQUS