BACK

What’s new in Laravel 6.0?

The team behind Laravel is proud to announce that 6.0 is finally out here! We have some new exciting features out there:

Let’s talk in detail about these in detail, starting with Laravel UI.

Laravel UI is moved out

The front-end scaffolding is moved out of the default Laravel framework, which means that Bootstrap and Vue is not present anymore. You will need to download with a composer as a separate package, which is called laravel/ui. It should be mentioned that make:auth is not available in the present framework anymore too, instead of this we have php artisan ui:auth available.

To install the default Bootstrap / Vue scaffolding just install the laravel/ui package using the composer tool.

composer require laravel/ui --dev

php artisan ui vue --auth

Bootstrap and Vue removal was done to allow UI scaffolding to be developed separately from the primary framework.

New and slick Exceptions Page

Ignitio Exceptions Page
The new Exceptions Page in Laravel 6.0

The new exceptions page is built upon an open-source project called Ignition and it is included to the new Larave 6.0 by default. Ignition was made by fellow developers Freek Van der Herten and Marcel Pociot.

The first thing that I love about Ignition is a slick and beautiful user interface and convenient user experience. New features include:

  • Improved error files and line number handling
  • Code Editing
  • Exception Sharing
  • Improved UI and UX

Semantic Versioning

This major release is now following the semantic versioning standard that will offer consistency with other first-party Laravel packages. If you are not familiar with the semantic versioning standard you can read about it here.

Improved Authorization Responses

With the previous releases, it was quite difficult to expose custom exception authorization messages to users using Gates, which would explain why the particular request was rejected. However, with the new release, we have a new Gate::inspect method that provides a convenient way to expose these messages. For ex. this is how our policy could look like:

public function view(User $user, Flight $flight)
{
    return $this->deny('Explanation of denial.');
}

Lazy Collections

Lazy collections were to let you keep memory usage low when working with large datasets. Instead of loading 10,000 Eloquent models into memory at the same time you can load them in one by one, but still running a single query.

$articles = App\Article::cursor()->filter(function ($user) {
    return $article->views > 500;
});

This achieves a drastic reduction in memory usage.

Eloquent Subquery Enhancements

In the previous release, you were sometimes forced to use DB::raw() , because of the limitations on what can you select in a subquery. However, with the new subquery enhancement, you can select data from 2 tables and order it using one single query.

return Destination::addSelect(['last_flight' => Flight::select('name')
    ->whereColumn('destination_id', 'destinations.id')
    ->orderBy('arrived_at', 'desc')
    ->limit(1)
])->get();

There’s a detail explanation of how this works right here.

Laravel Vapor

The new Laravel 6.0 provides compatibility with Vapor. Vapor is a new product from the Laravel creators to manage your application’s infrastructure. It is powered by AWS Lambda and it offers a simple way to scale your application. Some of the features:

  • DNS management directly from Vapor’s dashboard
  • Multiple environments
  • CloudFront CDN synchronization
  • Metrics for database and cache
  • Auto-scale web and queues
  • Redis cache management

You can read about Vapor right here.

New Branding

Laravel 6 Home Page
The new re-designed laravel.com website

With every major release, we usually have new branding and this time is no exception. We have a new logo and a re-design of the laravel.com website.

Newsletter

Get my content to your inbox every Monday. I promise, no spam included!

.

Leave a Reply

Your email address will not be published. Required fields are marked *