New features of Laravel 5 PHP framework

Laravel is one of the highly used and appreciated coding frameworks by the PHP developers. Developers prefer Laravel over to other frameworks because of the performance, features, scalability it offers. Here we will discuss some exceptional features of Laravel that makes it the PHP Developer’s first choice.



Laravel 5 was launched in November 2014. As expected, there were lots of functional changes in the Laravel 5. It was backed with 22 new features for developers. The company has upgraded the successful version of Laravel 5 in the February this year. The latest version of Laravel 5.1 is available now. Laravel 5.0.1 has restructured framework architecture in the latest release. The company has prominently simplified the Method injection. New route-caching feature has been added to Artisan. Let’s have a look over some of the most important features of Laravel 5. 
New directory structure 
It is a structural change that you might notice first. Laravel 5.0.1 implements PSR-4 autolading standards. That means all the classes are fully namespaced now. Config, Storage and Database folders are moved one level up from the App folder in the new structure. Everything else within folder works exactly the same as previous version. They have also added an additional resources folder. This new folder contains all language and template files. 
Method injection 
Method Injection has been significantly simplified in the latest version of Laravel. You had to demand Inversion of Control (IoC) container to provide a class instance until Laravel 4.2. But you can declare the type hinted class instance in the controller method's signature now.
<?php 
class UserController extends BaseController { 
public function _construct(UseRepositoryInterface $users){
$this->users = $users;
} 
}
Developers can do the same using Injection methods by injecting class into method like following:
<?php namespace App\Http\Controllers\Auth; 
use Illuminate\Routing\Controller;
use Illuminate\Contracts\Auth\Authenticator; 
use App\http\Requests\Auth\registerRequest; 
class AuthController extends Controller{
public function _constuct(Authenticator $auth)
{
$this->auth = $auth;
}
public function postRegister(RegisterRequest $request)
{
$this->auth->login($user);
return redirect('/');
}          
}
Contracts
Contract is basically a set of interfaces that defines the core services. If you need caching in package, you can achieve that using Illuminate\Contacts\cache. You can do cache programing anywhere in the code using the concrete cache class without changing the package code. All these happen in the Application.php file under Illuminate\Foundation\folder.
Route caching
Route caching feature speeds up the application route registration. This feature is perfectly suitable for you if your application has a large number of routes. You can use PHP artisan route: cache and PHP artisan route:clear commands to turn ON and OFF the route catching in the program. It is generally implemented as a part of deployment process.
Authentication
Authentication is the most important part of any web application and developers spent enormous time writing the authentication code. Authentication has become simpler with this update in Laravel 5. Laravel 5 contains the ready to use inbuilt authentication system. You just need to configure database migrations, models, controllers and views to make the system work.
Events object
Developers were enforced to declare application events as a string until now. But you can declare new events in the application using “event object” using Laravel 5.  You can create event objects using php artisan make:event <event-name> and event header object using php artisan handler:event <handler-name>. You can fire the events using Event::fire(new Event(params)) once you create any new event.
Multiple file system
Laravel 5 provides the native support for multiple file system. Laravel uses third party package Flysystem to provide multiple file support. You can use any of Local or Cloud based storage to provide simple configuration. You can configure storage options in config/filesystems.php file. You can also bypass all file system facade in the application and work directly disk facade.

These are some of the most advance features of Laravel 5. There are some other features as well. For example, Queue and Task Scheduling, Request Object, Laravel Socialite, Commands etc. Laravel 5 has improved a lot from the architectural perspective. It also works seamlessly for code organization and maintenance. You can install laravel 5 from here

Comments

Popular posts from this blog

remove span elements from Contact form 7 but keeping inside elements

Elance HTML5 Test Answers