4 Laravel 5.5 Features I am looking forward to using

Clevon Noel
Jul 25, 2017 · 2 min read

Laravel is one of the most well-documented, innovative, easy-to-use PHP frameworks I’ve ever used. The framework allows the ease of creating a scalable, stable and robust application coupled with the great community support. As Laravel 5.5 about to be released here are 4 features, in no particular order, I am looking forward to using.

1. Custom Validation Rules

As an alternative to using Validator::extend for creating custom validation, Laravel 5.5 will be introducing support for custom validation rule object.

To define a custom validation rule you can use a class which implements the Illuminate\Contracts\Validation\Rule interface or use a Closure.

Using the rule like so

2. DD and Dump in Collections

When I am debugging a complex collection pipeline it’s a little challenging. Frequently, I find myself temporarily commenting out pieces of code to confirm the output. In Laravel 5.5, however, you’ll find two new helper methods on the collection instances: dump() and dd(), which will allow you to know what happens in each step of the chain by either using dump() or dd() method.

collect([1,2,3])
->map(function($number) {
return $number * 2;
})->dd()->reject(function($number) {
return $number < 3;
});

Dump

collect([1,2,3])
->dump('original')
->map(function(int $number) {
return $number * 2;
})
->dump('modified')
->dd();

3. Faster Email Layout Testing

When I prepare the view for my emails, generally uses a service like Mailtrap to investigate the output. In Laravel 5.5, I can return a mailable instance directly from the route and review the output.

$router->get('mail/preview', function() {
return new OrderConfirmation($order);
});

Result

4. Fresh Migration

Migrate fresh is similar to migrate:refresh, however, migrate:fresh drops all the tables and migrate the database to start from scratch. This will help me when I need to rebuild your database during development.

Clevon Noel

Written by

Full Stack Engineer, ITO @ Grenada Hotel & Tourism Association, Co Found @ Sonover Inc

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade