Laravel 5.5 LTS is Now Released with New Features

Laravel 5.5 LTS is Now Released with New Features

After my previous writing the Reasons Why You Should Use The Framework Laravel, this time we will talk another plus-owned Laravel that is a very awesome feature that you should not miss.

Although Laravel 5.5 has been released August 2017 of the past, for you who have yet to obtain information on the latest features of Laravel, then there is no harm in you continue reading this article to completely. Here's a list of features that you should not miss out on the project you are using Laravel 5.5

Laravel 5.5 using PHP 7+

When will use Laravel 5.5 then you are obligated to update the version of PHP into the PHP 7 +, this, of course, will increase the speed of your web application and will save you the cost of your project is used. This is in line with the report announced by team engineer tumblr after using PHP 7 +.

“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”.

 Custom Email Templates

Although it belongs to the old, email is still a mainstay in providing information in any form. The interesting thing on Laravel is that we can easily make a feature to send emails since it has an available method that is ready to use. But on the previous version although it has had advantages in terms of making a feature to send email, by default we still use the default template Laravel though custom can also fit our desires because the world programming is the world of creativity without limits. However, things dancing on this latest version we have made to create custom email templates. 

On version 5.4 you can get started by creating a CSS file that contains a style for your template and then place it in the directory: resources/views/vendors/mail/html/themes/my_themplate.css Then update array markdown in config/mail.php:
'markdown' => [
  'theme' => ‘template_saya’,
  'paths' => [
     resource_path(‘views/vendor/mail’),
   ],
 ],

Whereas in version 5.5, you better be facilitated again to use email templates specifically for each of the categories of email for example. Then the things you have to do is to create a custom CSS file at:  resources/views/vendors/mail/html/themes/newtheme.css Then you can define them using the property $theme on any class Mailable.
class SendEmail extends Mailable
 {
 protected $theme = 'newtheme';
 }

Custom Rule Validation

Laravel 5.5 will introduce a special class to handle validation. There are two things to note in this class, namely making: Passes and Message. With this class, we can create a custom validation as we want.
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
class NewValidate implements Rule
{
  public function passes($attribute, $value)
  {
    return $value > 5;
  }
  public function message()
  {
    return ‘: attribute is still lacking!’;
  }
}

Frontend Presets

As we know that Laravel 5.4 has been vue. js as frontend Javascript, but in Laravel 5.5 will be introduced with 3 frontends: vue.js as default, react. js and bootstrap. You can use it as you want.

You can change the preset into the bootstrap using the command:
php artisan preset bootstrap

Laravel also provide the option to not use all of it using the command: 
php artisan preset none

Laravel Auto-Register Package

The previous version we have to write down a few steps to register the package with a service provider by adding the alias before use. The good news, at Laravel 5.5 has been available in new ways that are pretty cool in terms of addressing your package. How cool is Laravel automatically register to the service provider and add the alias on the composer.json when doing the installation package. Taylor Otwell named this feature: Package Auto-Discovery
"extra": {
  "laravel": {
    "providers": [
      //
    ],
    "aliases": {
      //
    }
  }
 }


The posting of this time may be useful.