February 2015 is when Laravel 5.0 was released and important updates have continued to come up every 6 months periodically. Only last year in September, we were raving out the 5.7 version and now Laravel 5.8 is out there in the open as well, which is good news for everyone involved.

A Brief Insight

For those who don’t know, Laravel is an open source PHP web framework, the brainchild of Taylor Otwell. Did we mention its free as well? It is meant for web application development based on the model-view-controller pattern of architecture along with Symfony.

What has allowed Laravel to create a niche for itself is the fact that it renders the development process a whole lot easier by simplifying most of the common tasks such as routing, authentication, caching and sessions. No wonder Laravel development services are on the rise, given the potential it possesses.

Laravel 5.8 has not only brought on interesting characteristics which are new to this world but has improved the core framework in its entirety and fixed some much needed bugs as well. Now that we’ve established the pre-requisite, let’s check out some features of Laravel 5.8 which need to be kept in mind whilst developing a project from scratch.

1. PHP dotenv

Along with Laravel 5.8, there’s a pre-integrated PHP dotenv 3.0 that gets shipped which comes the following feature-set:

– Top class support for multi-line variables.

– In order to mitigate errors or silent failures, variable names get subjected to stronger validation.

– You will receive values as is; value-trimming doesn’t occur anymore.

– There is a significant increase in the flexibility quotient in terms of the environment parts that are needed to modify and read.

– Now, rather than just a single path, a list of paths can be accepted to try in order looking for the dotenv file.

2. E-mail Validation

Laravel has a built-in validation rule in this new 5.8 version. How is it different? It will now allow you to enter international characters in e-mail addresses.

For eg.
A validation code such as:
$request->validate([ ’email’ => ’email’, ]);

With this, if you wish to validate ac@cŚd.se, which is full of international characters, the Laravel 5.7 version will render the process a failure. This is what’s different about the new version as now, both the SwiftMailer logic (this is the PHP mailer library of Laravel) and the validation logic are in line with the RFC6530 compliance.

3. Carbon v2

This newest rendition of Laravel has the capacity to incorporate and make use of both Carbon v2 and Carbon v1. Not just that, it can not only use CarbonImmutable but make it a default option as well. This is good news for any laravel development company, if you choose to hire one for your cause. Carbon v2 is an enhanced version by all means offering a higher standard of internationalization support than its counterpart.

4. Slack and Nexmo and Notification channels:

As opposed to being the main Laravel project, the Slack and Nexmo notification channels have now been shifted to the first-party packages. In order to make use of these functionalities, now you will need to use:

composer require laravel/nexmo-notification-channel
composer require laravel/slack-notification-channel

However, this is the only change here; they can be configured and put to use in a similar manner as in the previous version.

5. Directory Name Change – Mailables

This might not seem too critical, but if you’re not starting a project from scratch; instead upgrading an already existing one, this will come in handy especially if you’re looking to hire Laravel programmers for this.

If you possess mailables in your project and have used the php artisan vendor:publish command to customize the components, the folder names have been subjected to change. Basically, the /resources/views/vendor/mail/markdown directory has changed to named/resources/views/vendor/mail/text.

This is in some ways a no brainer as it makes more sense to name the markdown folder as ‘text’. Its because both the folders have the capacity to contain the markdown code for creating high quality responsive HTML templates.

6. Changes in Cache TTL

This is one of the most significant changes in Laravel 5.8 yet. Passing integers to cache methods now represents ‘seconds’ as opposed to ‘minutes’.

Eg. A command like:

Cache::put(‘foo’, ‘bar’, 15);
This will store the necessary items for 15 seconds in the new Laravel 5.8 whereas that would mean 15 minutes as per the 5.7 lingo.

7. Renewed error page templates:

Laravel 5.8 comes equipped with new error pages with an eye-catching minimalist design. This ensures that it will seamlessly work with an array of apps and websites without the need to be customized from time to time. The fact that you can still customize the error pages at will is another add-on. Importing older designs is also an option.

8. Deprecated Array and String Helpers

Don’t worry too much if you find that the array and string helpers have been deprecated in Laravel 5.8. Laravel plans on releasing these helpers as part of an optional package for users. These string and array helpers offer little or no value now (barring style) over usage of class equivalents.

9. JSON Values in MySQL:

Laravel 5.8 returns values in the form of cleaner strings which were returned in the form of double quotes in the 5.7 version. This is when JSON values are stored in MariaDB database columns and MySQL. You need to keep a note of this when you hire Laravel developer.

This is the Laravel upgrade guide example which highlights the change in consideration:

$value = DB::table(‘users’)->value(‘options->language’);

dump($value);

// Laravel 5.7…
‘”en”‘

// Laravel 5.8…
‘en’

10. Automatic Policy Resolution:

If the models and policies are in conventional locations, from Laravel 5.8 onwards, you will no longer need to register them in the AuthServiceProvider class. However, if you’re tilting towards the unconventional paths, you can then register a callback in order to configure them manually.

Here’s how:

GateLLguessPolicyNamesUsing(function ($class) {

// Do stuff

return $policyClass;

});

The new Laravel features makes it more robust and provides more options for rapid application development.

Looking for Laravel application development service or need to hire dedicated Laravel developer, then get in touch with us to jump start your Laravel web development project.