Ever since its debut in 2011, Laravel has become a favorite choice among developers for web application development. The free open-source PHP web framework recently launched its latest version, 5.7, only six months after launching 5.6 version. The latest version release is more about fixing bugs present in the previous version and updating Laravel’s security system. Laravel 5.7 continues with advancement made in Laravel 5.6, introducing Laravel Nova, Email Verification and other minor major changes.
Laravel follows a paradigm.major.minor release system, which means there are two major launches biannually that are released usually in February and August. Minor updates are launched every week.
Few Highlights of Laravel 5.7
- Resources Directory Changes
- Laravel Dump Server
- Email Verification
- Laravel Nova
- Guest User Gates / Policies
- URL Generator & Callable Syntax
- Pagination Links
- Notification Localization
- Improved Error Messages
- Testing Artisan Commands
The latest version is always better than the previous one, so let’s take a look at what Laravel 5.7 has in store for Laravel web development:
# Guest User Gates
In Laravel 5.6, web applications made using it denied unauthorized access but Laravel 5.7 offers optional type hint or value to the unauthorized user who goes through authentication checks.
Gate::define(‘update-product’, function (?User $user, Product $product) {
// …
});
# Laravel Nova
One of the biggest highlights of the PHP framework, Laravel Nova is an administrative dashboard or panel, which is driven by code that appears when a developer starts working on a new PHP web development project. Laravel Nova was available on 5.6 version as well but only came in a single composer package. 5.7 version has multiple composer packages.
Laravel Nova requires following packages before installation:
- Composer
- Node and Npm
- Laravel Framework 5.6+
- Laravel Mix
After this, you can download a Nova from the release section on the Nova website after purchasing a license.
# Email Verifying System
Laravel 5.7 brings us in touch with the framework’s latest feature — email verification. To use the feature, you will have to type email_verified_at timestamp column to your table migration. If you want new users to go through email authentication, you will have to use the MustVerifyEmail interface.
This is how the code will look like including the interface:
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable implements MustVerifyEmail
{
// …
}
# URL Generator & Callable Syntax
Developers can use the URL Generator & Callable Syntax to control the way URLs are created. It allows Laravel to support callable array syntax instead of strings only.
This is how the older version looked –
$url = action(‘BlogController@index’);
$url = action(‘BlogController@view’, [‘id’ => 1]);
This is how 5.7 version looks –
use App\Http\Controllers\HomeController;
$url = action([BlogController::class, ‘index’]);
$url = action([BlogController::class, ‘view’], [‘id’ => 1]);
# Symfony Dump Server
Symfony Dump Server is a command via package developed by Marcel Pociot. The feature helps to debug an application error without hindering the application runtime. It runs in the background and collects information during application transfer.
php artisan dump-server
// Output to the HTML file.
php artisan dump-server –format=html > report.html
# Notification Localization
A Laravel developer can now send notifications in regional languages. The Illuminate\Notifications\Notification class has a locale way to help you find the language of your choice. When a developer formats a notification, the web application is turned into a locale. After the formatting process is over, the notification is transferred into its former locale.
# Pagination Links
As a Laravel solution provider, you now have access to three links on either side on default. Using the latest feature, you can control paginator link quantity using the onEachSide ().
This is how you can do it:
{{ $pages->onEachSide(5)->links() }}
Other new features that you can find in the 5.7 version include improved error message protocol, change in reading or writing stream methods in FileSystem, and new resources directory.
Few of the Benefits of Laravel PHP Framework
1) Authentication and Authorization System Creation
In Laravel Authentication implementation is very easy. Authorization logic and control access to resources are also very simple.
2) Mail Services Integration
Simple API for Mailing and drivers for SMTP, Mailgun, Mandrill, SparkPost, Amazon SES allows send and receiving mail quickly.
3) URL Routing Configuration
All routes are defined in app/HTTP/routes.php file.
4) Open Source
Free and Open source allows simple and complex Laravel Web Application Development quickly.
5) Composer Feature
Composer dependency manager for 3rd party installation and upgradation allows easy management of dependencies.
6) Message Queue System Configuration
Queue feature allows you to defer the processing of a time-consuming task, such as sending an email which speeds up the web requests.
7) Templates
Inbuilt powerful templating engine – Blade which is compiled in plain PHP and cached for optimal use.
8) 3rd Party Tools Integration
Memcached and Redis are used in caching. For larger applications, it is good to use inbuilt memory like Memcached or APC for fast applications.
9) Technical Vulnerabilities Fixing
It provides security against the SQL injection, cross-site request forgery, and cross-site scripting.
10) Error Configuration and Exception Handling
Error and Exception handling is very easy in Laravel. Integration of Monolog logging library provides powerful log handling.
11) Automation Testing
It provides support for PHP Unit testing by default. It helps to track the behavior of the users.
12) Object-Oriented Libraries
Pre-Installed libraries have made Laravel very popular among developers.
With Kanhasoft’ proficient and experienced dedicated Laravel Developers, we guarantee to help you to keep up with the latest technologies. Hire dedicated Laravel developers for your development project today!