Have no fear! Laravel 5.7 is here!

Laravel is supported actively and developed constantly. It’s an open source project which made the first appearance about seven years ago in the late spring of 2011 to be precise. From that point forward, the framework has managed to make its name to stand out amongst the greatest PHP frameworks for web apps, implementing the well known architectural pattern of the Model View Controller (MVC), in addition to being based on Symfony. Laravel is a great choice when it comes to PHP developers and also one of the well known free open source available frameworks. The source code is licensed with MIT, as well as hosted on GitHub.

The long-awaited 5.7 version release had finally become a fact earlier on September 4th, 2018. It quickly became a popular topic and received great feedback from the large group of active developers. Version 5.7 of the PHP Framework introduces multiple new features that make it even more functional and lots of bug fixes/improvements over the previous 5.6 version.

Before we go ahead, we wish to note that the PHP framework is said to be rolling out bug fixes until 02.2019. As for the security fixes, the plan is until 08.2019. So now, let us begin!

Laravel Nova

Being the most awaited package, Laravel Nova has been announced officially by Taylor Otwell in the course of Laracon US 2018. It’s undoubtedly the most important and significant feature or package that has been introduced to date. It is now available on the market, and to tell you more, Nova is not a simple feature, but rather a stand-alone package that helps with the performance of different functional operations.

Nova’s main feature is the capability to maintain your underlying database records through the use of Eloquent. In addition to that, Nova offers additional support for lenses, filters, actions, metrics, queued actions, custom cards and tools, authorization, and more. You are able to install the separate package in the project you are currently developing, or even in one of your existing projects. The installation can be completed by using Composer, in order to create a well-put, code-driven administrative dashboard or panel for development. More good news v. 5.6 also supports Nova as a single composer package.

Feel free to go ahead and purchase the initial release of Laravel (v1.0. “Orion”), which is available on the official website. The license for this excellent package comes at a whopping $99 for a solo and $199/site when you pick the enterprise plan. Take note that Nova has some required packages prior to its installation:

  • Composer;
  • Node and Npm;
  • Laravel v 5.6+;
  • Laravel Mix.

In case you wish to get a little bit more educated about this new package, you can go ahead and check out the comprehensive article by Taylor Otwell. You will be able to find it on Medium, or Nova’s official documentation.

Resources Directory Changes

There are some minor changes in the resources directory of Laravel 5.7. The directory is flattened now, removing the folder “assets” that appeared in the previous version of the framework.

Taylor Otwell announced this change for the public by tweeting about it. Since assets won’t be in the Resource directory anymore, instead of it there will be JC, lang, Sass, and views.

Email Verification

As we are all familiar with the framework’s default authentication system, 5.7 provides a new, optional email verification. In order to utilize the feature, one has to include the email_verified_at timestamp column to the users migration table. There is no need to do that manually since it comes with the default migration. All that has to be done is run the migration.

In order to get more new users to check and verify their emails, the User model should make use of the “MustVerifyEmail” interface. This way the user model would look like below:


namespace App;

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

class User extends Authenticatable implements MustVerifyEmail
  // ...

Once the User model is marked with the MustVerifyEmail interface, all the newly registered users will receive an email containing an account activation verification link. It activates their respective accounts as soon as they click on it. Once this link has been clicked, Laravel will automatically record the verification time in the database and redirect users to a location of your choosing.

Laravel 5.7 also provides a verified Middleware along with this email verification feature. This middleware may be attached to routes that should only allow verified users:

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

Guest User Gates / Policies

In previous versions of Laravel, authorization gates and policies automatically returned false for any unauthenticated users trying to access the application. However, with Laravel 5.7 you can now allow declare an “optional” type-hint or supply a null default value to allow the guest user to pass through the authentication checks.

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

Notification Localization

Laravel now allows you to send notifications in any other than the current language by assigning locale for it. It will even remember this locale if the notification is queued.

To accomplish this, the Illuminate\Notifications\Notification class now offers a locale method to set the desired language. The application will change into this locale when the notification is being formatted and then revert back to the previous locale when formatting is complete:

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

The localization of more than one notifiable entries could also be accomplished through the use of the Notification facade:

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

Console Testing

Laravel’s 5.7 version allows us to “mock” with ease any user inputs for commands in the console. You can do that via the expectsQuestion method. Additionally, we are able to specify the code for exit and the text, which is expected as an output by the console command, utilizing the assertExitCode and expectsOutput methods.

Paginator Links

The 5.7 version of our favorite PHP framework has a new method for pagination in order to edit the number of links being shown on either side of the paginator URL window. While you’ve worked on paginator previously, you would’ve seen 3 links in it, being there by default. Nevertheless, Laravel 5.7 allows you to define them particularly, which gives you an easier way to handle paging in a precise way. This new method is the reason for you to no longer need the custom paginator view in some specific cases.

Improved Error Messages

Version 5.7 of the framework makes everything much easier when it comes to tracking all error messages. This is possible thanks to Joseph Silber, who is a Bouncer developer. With this new version, we get a much cleaner and compact text message that indicates the approach does not exist on a singular model. All of this is possible because version 5.7 now implements the Bouncer package, which would display “errors” message on dynamic calls to Eloquent models.

URL Generator & Callable Syntax

The new version presents an all-new “callable” syntax while producing URLs to controller actions, instead of supporting strings only. You may likewise find out about this component called “tuple notation” or “callable array syntax” for URL generation actions. One benefit of the new syntax format is the actual capability to operate directly to the controller in case you make use of the text editors or IDE that are able to support code navigation:

action([UserController::class, 'index']);

Laravel Dump Server

Version 5.7 comes along with the incredibly effective new PHP command for artisan dump-servers. Marcel Pociot wrote the command, this command provides a wrapper around Symfony’s VarDumper component. This command is provided out-of-the-box and grants users the power to dump data. As a response, the output gets swallowed up and after that printed in an HTML file or console, rather than to the browser itself.

Symfony’s Dump Server is perfect for debugging any kind of errors in the app. You also won’t have to hinder the runtime. The command is in the background and also gathers all the data that is transmitted from the apps, furthermore displaying output through the console mode.

php artisan dump-server
# Or send the output to an HTML file
php artisan dump-server --format=html > dump.html

Better ways of testing Artisan Command

Laravel 5.7 ships with upgraded support for experimenting with the Artisan commands. You are now able to leverage the beneficial expectsQuestion() and expectsOutput() methods to ensure that all commands function as expected.

Installing Laravel 5.7

As we can all see, a lot of fresh features are coming up with this new release, so you probably should be eager about trying them out by now.

This last version is not yet available in Softaculous, but it still can be manually installed via Composer. In order to pull the latest Composer version before the installation, you have to check if your hosting account’s needed version is set up to PHP 7.1+. Overall, PHP 7 is much faster, secure, and more resource-efficient than the older versions.

The command to use in your /home/user/.composer directory:

composer global require "laravel/installer"

To create a new instance of Laravel, you will have to go to your public_html and type:

composer create-project --prefer-dist laravel/laravel blog

Blog name stands for the name of the folder which will be created and where the framework will be installed. After doing all of the above, go ahead and access the folder and execute:

find . -type d -print0 | xargs -0 chmod 0755 && find . -type f -print0 | xargs -0 chmod 0644

This is going to change the permissions to the desired ones which will allow the display of the public folder to be correct. Also, you will be able to open the website on your browser.

Upgrading to Laravel 5.7

Upgrade to version 5.7 requires PHP 7.1.3, so prior to proceeding with this upgrade, make sure that this PHP version is set up. The estimated time for an upgrade from v. 5.6 is up to fifteen minutes. The mileage varies based on your application.


Laravel 5.7 came loaded with brand new features and serious improvements. Nova is also a product that every developer should give a try.

If you enjoyed this article, then you’ll love FastComet’s Laravel SSD Cloud hosting platform. Experience increased power, flexibility, and control for your applications.

Have you upgraded to version 5.7 yet? What do you think? Go ahead and share with us in the comment section! Cheerful Coding!


Elena oversees all Marketing, Product Management and Community efforts for FastComet and is in charge of telling the brand's story. Always pitching, she’ll share the FastComet vision with anyone who’ll listen. Elena helps our customers make the most of their web sites' and focuses on our inbound marketing efforts; everything from developing new online growth strategies, content creation, technical SEO, and outreach within the FastComet community. Her background includes Sales and Customer Relationship development, as well as Online Marketing.