Changes from Laravel 4 to Laravel 5

Laravel 5 started life as Laravel 4.3, but was promoted to its own major version when it became apparent that this new version was going to be a radical departure from version 4 of the framework.

Laravel 5 builds on Laravel 4 as a base, but makes architecting larger applications with things like an application namespace out of the box. Laravel 4 applications will need a fair bit of work to be ported to Laravel 5.

Features that are new or have been updated in Laravel 5 include:
  • Method injection: In Laravel 4, you could type hint (specify in the constructor) the dependencies a class needed, and Laravel would automatically resolve those dependencies out of its container. Now, Laravel 5 takes that one step further and will also resolve dependencies specified in class methods, as well as class constructors.
  • Form requests: Laravel 5 introduces form request classes. These classes can be injected into your controller actions. They take the current request, and on it, you can perform data validation and sanitizing and even user authorization (that is, check if the currently-logged in user can perform the requested action). This streamlines validation, meaning you have to do very little, if any, data validation in your controller actions.
  • Socialite: New to Laravel 5 is an optional package called Socialite that you can declare as a Composer dependency. It makes authenticating with third- party services a breeze, meaning you can easily implement functionality like login with Facebook in a few lines of code.
  • Elixir: Laravel 5 also looks at making front-end development easier. A lot of developers these days are using languages like LESS and Sass to create their style sheets, and concatenating JavaScript files into one, minified JavaScript file to reduce HTTP requests and speed up loading times. Elixir is a wrapper around Gulp, a Node.js based build system that simplifies the tasks mentioned here. This greatly reduces the time needed to get up and running with a new application, as you don't have to install Node.js modules or Gulp files from other projects. You get it free from the get-go.

No comments :

Post a Comment

Leave A Comment...