Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

What has changed in Laravel 5.5?

Monday, September 18th, 2017 by Servage

laravelA new major version of Laravel is scheduled for release in late August 2017. In addition to being a long-term support release, many new features will be added to the framework, including a new error handler, custom validation rules, a new Artisan command and more. Let’s have a closer look at these new features.

The “migrate:fresh” Command

In previous versions of Laravel, the migrate:refresh command has been used as a quick way to roll back all changes made to a database. What it does is simply execute the down() method of all migrations followed by the up() method.

The new command migrate:fresh does the same but skips calling the down() method first. In many cases, down() simply drops the database table in question. This is what migrate:fresh does. It drops all tables and then runs the up() method of all migrations. This can be useful because in Laravel 5.4.17 the down() method became optional and not all migrations have it anymore.

Composer Package Auto Discovery

Every time you add a new library to your project using Composer, you have to add the new service to your service providers array and possibly to the aliases list too. Laravel 5.5 allows you to install packages without having to manually add the lines because Composer does this automatically. It also removes any service provider registrations and aliases when you remove a package with “composer remove”.

Validator Returns Validated Data

The way you validate input in Laravel looks like this: $this->validate($request())… From now on, you can assign the result of the method call to a variable to get the data back, like this: $input = $this->validate($request())…

Whoops is Making a Return

If you have ever found the long stack traces of the “Whoops!” error pages in Laravel confusing, here’s some great news for you! Whoops is an error-reporting framework found in Laravel 4 but it was no longer part of the framework in version 5. Now it is returning back to Laravel.

Whoops gives you some great feedback on what has caused a fatal error in your application. It even shows the line of code and its surrounding lines in a visual code view.

PHP 7.0 Required

Although this is not a new feature, it’s worth mentioning that Laravel 5.5 is going to drop support from PHP 5.6 and older versions. PHP 7 gives a nice performance boost for your website, allowing it to execute code even twice as fast as before. It’s also more resource friendly. At the same time while speeding up your website, it can reduce server load to half. Not to mention the new features it brings for developers.

What has changed in Laravel 5.5?, 3.7 out of 5 based on 3 ratings
Categories: Software & Webapps, Tips & Tricks

Keywords: ,

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet (leave a comment)

You are welcome to initiate a conversation about this blog entry.

Leave a comment

You must be logged in to post a comment.