Top 6 Awesome Features in Laravel 5.5 Which You Should Include in Your Next Project

Laravel 5.5 is going to release soon in August 2017 so if you are planning for new project using the Laravel then you should leverage the benefit of following features.

1.Frontend Presets

As we all know Laravel 5.4 have vue.js as preset frontend JavaScript but Laravel 5.5 will be introduced with 3 frontends preset: Vue.js as default, react.js and bootstrap, you can change as per your preference.

you can change the preset to bootstrap using this command:

php artisan preset bootstrap

We can change the preset to react and vue by replacing the bootstrap in above command, Laravel 5.5 will also provide the option to remove the all 3 to load your own JavaScript or PHP backend only app by following command:

php artisan preset none

2.Laravel Auto Package Discovery

In earlier version developer had to write the following package step to register its service providers and adding aliases before pulling, Laravel 5.5 have new cool way for package developer, you can review the Taylora’s post for more detail.
Install the package:
composer require school/kids

Register the provider in app.php:

School/Kids\ServiceProvider::class,

Optionally, register Facade:

'Bar' => School/Kids\Facade::class,

New cool way to write the pull request automatically register service providers and add aliases through the package’s composer.json in Laravel 5.5

"extra": {
"laravel": {
"providers": [
"School\\Kids\\ServiceProvider"
],
"aliases": {
"Bar": "School\\Kids\\Facade"
}
}
}

3.Laravel 5.5 Require PHP 7+

Laravel 5.5 will have PHP 7+ version, it will improve the speed of web application and will save a cost for your project. You can check the report of engineering team of tumblr who have recently implemented the PHP 7+ version

“Almost immediately saw the latency drop by half, and the CPU load on the servers decrease at least 50%, often more. Not only were our servers serving pages twice as fast, they were doing it using half the amount of CPU resources – Tumbler engineering report“

“Etsy is a popular PHP-based online marketplace for handmade and vintage goods that has been in operation since 2005 (29 million items listed on its website, 54 million registered users, among them 1.4 million active sellers, and 19.8 million active buyers). Initially it was written in PHP 5, and later, was switched to HHVM (Virtual Machine for PHP). After migration to PHP 7, Etsy was significantly better from such perspectives as the memory and system/user CPU usage, homepage/listing delivery speed and number of hosting servers – Etsy Case Study

If you are using the older version of Laravel 5+ then you can easily upgrade to PHP 7+ version, you can find the migrate document on official PHP site.

4.Custom Email Theme Setup

Today’s new era of software industry brand expression is most important in every process of product while user interact with it, In earlier version of laravel we can easily send the email but has been sent using default email template. If you want to use your branding in Laravel 5.4 then you need to follow below steps:

You can start by generating a CSS file containing your custom styling like below:

// my-design.css is the name of your theme
resources/views/vendor/mail/html/themes/my-design.css

Now update the markdown option of your mail.php config file:

'markdown' => [
'theme' => 'my-design',
'paths' => [
resource_path('views/vendor/mail'),
],
],

In Laravel 5.5, we can send the custom email template with your perfect branding more easily. i.e you wanted to send the notification email to users then you can write your own CSS.

//Create css style sheet
resources/views/vendor/mail/html/themes/techuzITFirm.css

Now define $theme property that references your new theme on any Mailable class

class SendInvoice extends Mailable
{
protected $theme = 'techuzITFirm';
...
}

5.DD and Dump for Easy Debugging

In collection class of Laravel 5.5, two methods will be introducing for easy debugging-DD and Dump, let’s understand by simple example:

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

In above condition knowing the all step of each chain may be difficult so you can dump at some point.

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

dump() outputs the results below:

Collection {#181 ?
#items: array:3 [?
0 => 3
1 => 6
2 => 9
] }

dd() on the other hand stops the process immediately and dumps out the results:

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

6.Custom Validation Rule

Laravel 5.5 will introduce the dedicated class to handle the validation, to define the custom validation rule you need to create the class with two methods: Passes and message, let’s take an example to understand better:

<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
class HireProfessionalLaravelDeveloperIndia implements Rule
{
public function passes($attribute, $value)
{
return $value > 5;
}
public function message()
{
return ':attribute needs more Developers!';
}
}

In my article I have introduced the features that I’m excited about for implementing in our next project at Techuz Infoweb – Innovative Laravel development company India, Laravel 5.5 have some more features as well, You can follow the Taylor Otwell – Founder of Laravel to get news & updates.

Nilesh K.: Nilesh, a seasoned marketing manager at Techuz, plays a pivotal role in driving the firm's web and mobile app marketing endeavors. With a passion for connecting audiences with innovative digital solutions, Nilesh brings a wealth of expertise to Techuz. His dedication to leveraging strategic marketing tactics ensures that Techuz's cutting-edge web and mobile applications services reach their intended audience effectively.