What's New Coming to Laravel 5.7 Release

What's New Coming to Laravel 5.7 Release

Laravel a most popular PHP framework, which is actively supported and contributed open source project, which is reaching to its next release 5.7 in August 2018.

The release will receive bug fixes until February 2019 and security fixes until August 2019.

This release continues to improvements for the previous version 5.6, and also includes some exciting new features.

In this blog post, I'm listing some cool features that are already announced by the Laravel team and taking some reference from the github repository.

I'll keep on updating this post up to the final release is announced from the official team, as new pull requests are still coming from the community contributors.

1. Laravel Nova

Laravel Nova%2C beautifully designed admin panel package for Laravel.

The most awaited laravel package that was announced by Taylor during Laracon US 2018, and which is a beautiful admin panel package for Laravel application. It is a code-driven admin panel for your new or existing laravel project. The previous version of Laravel still supports Nova, as it is a simple composer package. To know in depth about it follow the official documentation, also go through the introduction article on the medium by Taylor.

Laravel Nova is officially released now on Aug 22, 2018, the initial release v1.0.* (Orion) is now available to purchase from the official website.

2. Email Verification

The framework introducing optional email verification feature with this release. To utilize this feature, you have to add the email_verified_at timestamp column to the user's table migration that ships with the framework.

To advise newly joined users to verify their email, the User model should implement the MustVerifyEmail interface.


namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements MustVerifyEmail
    // ...

After implementing the interface, the newly registered members will receive an email containing a signed verification link. Once the user clicks this link, the application will automatically update the database and redirect the user to the intended location.

This new feature also introduced a verified middleware. If you wish to protect your application's routes from only verified members, it can be attached to the application routes.

'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,

3. Guest User Gates / Policies

The previous version of Laravel used to return false if an unauthenticated user wants to access the application. However, with the new version (5.7) it will now allow declaring an "optional" type-hint or supplying a null default value to permit the guest user to pass through the authorization checks.

Gate::define('update-product', function (?User $user, Product $product) {
    // ...

4. Symfony Dump Server

The Symfony's dump-server is coming to Laravel 5.7. It is a command via package built by a Laravel community member Marcel Pociot.

This feature will be a lot useful to debug an error on your application without interrupting the application runtime.

Laravel 5.7 Dump Server

The command runs in the background and collects data transmitted from the application and shows output through the console mode.

php artisan dump-server

// Output to the HTML file.
php artisan dump-server --format=html > report.html

This package is open sourced by the author, contribute if you have any idea for it.

5. URL Generator & Callable Syntax

To generate the URLs to controller actions, Laravel now supports callable array syntax, instead of strings only.


$url = action('BlogController@index');

$url = action('BlogController@view', ['id' => 1]);


use App\Http\Controllers\HomeController;

$url = action([BlogController::class, 'index']);

$url = action([BlogController::class, 'view'], ['id' => 1]);

6. Paginator Links

You can now control the number of pagination links on each side of the paginated URLs design. By default, there will be three links created on each side of the paginator links. The newly introduced method onEachSide() allows to control them with Laravel 5.7.

{{ $pages->onEachSide(5)->links() }}

7. Read / Write Streams method in Filesystem

Laravel 5.7 introduces new methods for the Filesystem integration.


8. Notification Localization
You can now assign locale for the notifications to send other than the current language.

The Illuminate\Notifications\Notification class adds new locale method to assign the desired language.

$user->notify((new NewUser($user))->locale('np'));

You could also utilize the facade to set localization for multiple notification entries.

        ->send($subscribers, new WeeklyNewsletter($newsletter));

9. Improved Error Messages

You can now better track your errors messages with your Laravel application. As of Laravel 5.7, you will get a cleaner concise message saying that the method doesn't exist on the specific model.

Improved Error Messages

10. Resources Directory Changes

A little bit changes to the resources directory coming with the new release.

This change was announced by Taylor with a tweet, as assets directly will go away and js, sass, lang, views coming out into the resources directory.

Laravel 5.7 resources directory changes.

When you upgrade your application to 5.7, you don’t need to reconstruct the resources/asset directory according to the newer directory structure. The older structure will still work.

11. Testing Artisan Commands

The first employee of Laravel (Mohamed Said) recently contributed a great feature in the framework to test artisan commands. He announced via his tweet about this feature, and which is also documented in official documentation already. Now, with this addition, framework now provides a simple API for testing console applications that ask for user input.

class InstallCommandTest extends TestCase
    public function testInstallTest()
        $this->artisan('app:setup', [
            'name' => 'Setup New Project'
            ->expectsQuestion('Are you sure you want to start installation ?', 'Yes')
            ->expectsQuestion('Please select your preferred version', 'v2.5')
            ->expectsQuestion('Do you want to run composer dump -o ?', 'Yes')
            ->expectsOutput('Generating Optimized Autoload Files...')


Thanks for reading this article up to the end, please follow this article in later dates to know more new features coming to the 5.7 release.

Happy Coding!