10 New and Utilitarian Features of Laravel 5.8 Framework

CREATE COMMUNICATE CONNECT

Awesome Experiences Brand Stories Your Customers

Tuesday, Jun 11, 2019 / Web Development / samir

10 New and Utilitarian Features of Laravel 5.8 Framework

Features of Laravel 5.8 Framework

Laravel is the favorite PHP framework of many professionals for the development of custom software. This framework makes it easy for the user to implement authentication and provides a clean and user-friendly API. It supports the popular cache backends, such as Redis/Memcached. This framework also releases updates at six-month intervals to fix all issues and to increase the efficiency of users. The latest version of Laravel (5.8) was released on February 26th 2019, and this version also brings some exciting new Laravel features.

 Support of Carbon 2.0

Support of Carbon 2.0

The latest version of Laravel supports Carbon 2.0 (Carbon Date Manipulation Library) making it easier for the professionals to work with date and time. Carbon 2.0 includes a new Date facade along with a CarbonImmutable class. The CarbonImmutable class enables a user to make the copy of an original datum and to modify the copy without changing the original datum. It is possible to use this feature via the AppServiceProvider. To create a copy of any date and to use the Date façade, a user needs to update the ‘\routes\web.php’ file.

 Hashed Tokens

Hashed Tokens

It is not always necessary to use the Laravel Passport for the Laravel API authentication. However, most users are unaware of this fact. A user-friendly ‘token guard’ provides the basic API authentication. This facility is available through the earlier versions of Laravel. However, Laravel 5.8 comes with an additional facility. This latest version supports the storing of tokens as SHA-256 hashes. This feature offers a higher level of security when storing the tokens.

 Automatic Policy Resolution

Automatic Policy Resolution

In Laravel framework, the ‘Policies’ are used to handle user authorization. The policies are regarded as ‘Classes’ that organize the authorization logic around a particular model or resource. With the release of Laravel 5.8, it is not necessary to manually register the policies in AuthServiceProvider. This framework can automatically discover the policies. However, it is essential for the model and policy to follow the standard Laravel naming conventions. For this automatic feature to function, it is equally essential for the ‘policy directory’ to be in the default location.

 Inclusion of HasOneThrough Relationship

Inclusion of HasOneThrough Relationship

This feature already exists in the Rails framework. With the inclusion of ‘HasOneThrough’ relationship, Laravel 5.8 brings efficiency into the tasks of web artisans. For example, if the User model has one Profile model and the Comment model has one User, then the web-experts can use the ‘HasOneThrough’ relationship in order to get the profile for any given comment.

 Cache TTL Modification

Cache TTL Modification

In earlier versions of Laravel, the caching was set in minutes. The 5.8 version enables a precise setting of the expiration time at the time of storing the items. In this version, the caching is set in seconds.

For example, the ‘Cache::put(‘foo’, ‘bar’, 30)’ command stores the item for 30 seconds instead of 30 minutes.

This simple yet important modification offers compliance with the PSR-16 caching library standard.

 Improvement of Artisan Serve

Improvement of Artisan Serve

The earlier versions of the Laravel framework did not allow users to serve multiple applications. The improvement of Artisan Serve in Laravel 5.8 liberated the users from this limitation. In earlier versions, if one ‘serve’ command is running on port 8000, then it becomes impossible to serve another application on this port. In Laravel 5.8, the ‘php artisan serve’ command can scan for an available port up to ‘port 8009’ enabling the users to serve multiple applications at one time.

 Improvement of Artisan Call

Improvement of Artisan Call

The 5.8 version of Laravel makes it possible for a user to make the ‘Artisan’ commands from the code utilizing the ‘Artisan::call’ method. In Laravel 5.8, the users may pass the options in one string instead of passing the options as an array that was applicable in the previous versions.

 Scheduler Timezone Configuration

Scheduler Timezone Configuration

In Laravel framework, you may use the ‘timezone’ method to define the ‘timezone’ for a scheduled task. In earlier versions, a user had to repeat this method for each scheduled task. This could have become a tiresome task if a user was supposed to schedule multiple tasks. Laravel 5.8 framework liberates you from this cumbersome process. You may define the ‘scheduledTimezone’ method in your ‘app/Console/kernel.php file’ and return to the default timezone. This simple process attaches the ‘timezone’ to every scheduler saving you from the repetition of tasks.

 Higher Order or Where Method

Higher Order orWhere Method

In the earlier versions of Laravel, it was essential to use the ‘or’ query operator in order to combine the model scopes. This method necessitated a ‘Closure’ callback. Laravel 5.8 brings a ‘higher order’ ‘orWhere’ method enabling the users to put the ‘scopes’ together without using the Closures.

 Mock & Spy Methods

Mock & Spy Methods

In Laravel 5.8, the ‘mock’ and ‘spy’ methods have been included in the base Laravel test case class. These methods automatically bind the ‘mocked’ class into the container enabling the users to create cleaner codes.

Conclusion

The latest features of Laravel 5.8 eliminate many limitations for the web-developers enabling them to quickly and efficiently perform various tasks. It also becomes possible for the web-artisans to develop cleaner codes through the 5.8 version of Laravel framework.

divider
Download this free ebook of

A Detailed Explanation Of The WordPress Platform

DOWNLOAD THIS FREE EBOOK OF

Website UI/UX guide for 2019

line

You have a visionWe know the way to get you there.