THE BEST PRICE PER QUALITY RATIO. UP TO 60% OFF HOSTING

Web Hosting, VPS, Dedicated Servers, and more!

Laravel 5 is here and we are ready to host it

Laravel 5 is here and we are ready to host it

With all the exciting innovations we expect this year Laravel 5 will be one that brings lots of presents to all developers using the rapidly gaining popularity and well-renowned framework. We wish you happy programming and clean code during the new year. Take a look at what’s new…

New Directory Structure

app/
                       Console/
                       Http/
                                  Controllers/
                                  Filters/
                                  Requests/
                                  routes.php
                       Providers/
            bootstrap/
            config/
           database/
                     migrations/
                      seeds/
           public/
           resources/
                        lang/
                      views/
            storage/

Application logic is now grouped by the path in which the framework is accessed.
The commands directory is renamed to Console because of the command oriented architecture that is gaining popularity amongst the PHP community, including the Laravel Framework. Further more, this new structure will aim to avoid any confusion with artisan commands, making things more separate and comprehensive for developers.

Since Laravel 4.3 most of the subdirectories of the app have been pulled one directory up. This gives it a far cleaner structure and further advances its ease of use. Included here are config, database, storage and tests. The app directory now contains only access points. As of Laravel 4.3 you can describe your routes in app/Http/routes.php

The lang and views directories have also been moved a little, now placed in a resources directory, again at the root of the framework.

Service providers are the place in your Laravel application where core services are bootstrapped. What do we mean by “bootstrapped”? Simply said this means they are basically “registered” – this includes registering event listeners, filters and even routes. In Laravel 4.2 if you open the config/app.php file you’ll see an array with the service providers. In Laravel 5 each and every one of them has a separate configuration file in app/Providers.

Form requests for validation and authorization

In the newest version of Laravel, the concept of requests is introduced to the framework. It allows us to wrap up logic that we would pass down as an HTTP request, but is more that just a route filter. One of the uses for this is data validation is, for example, User Login Validation.

New File generating commands

The new service providers functionality implies the need for new file generator artisan commands. We can now create new service providers through the command line. Here are some of them:

make:request – allows us to create the previously mentioned requests

make:provider – make a new service provider

make:auth – generates all the required classes for your user authentication

Spiffy Authentication

Speaking of the last command, the auth commands now provide you with a more automatic way for creating authentication forms and all the required classes for your user authentication system. This can save you a lot of time when you are in the early stages of development.

  • auth:login-request– generates a form request for validating a login request.
  • auth:register-request– generates a form request for validating a register request
  • auth:controller– generates an authentication controller with the necessary boiler-plate methods.

Multiple Filesystems

In Laravel 5 you can now use the Filesystem class, which provides you easier interactions with the local filesystem, so you can effortlessly work with your AWS/s3 and Rackspace files.

Socialite

This is a new package that simplyfies the work with Facebook , Twitter and all sorts of third-party authentication through a common interface. You can also use GitHub as third-party login method. With the social networks popularity at an all time high, we have found this to be very useful for social sharing all around.

Laravel Elixir

Elixir is a wrapper around Gulp that simplifies its syntax and the work flow with it. Elixir supports several CSS and Java Script preprocessors and even testing tools. One of the useful things you can achieve with Elixir and Gulp is minimizing your CSS and Java Script files, better optimizing the environment.

To install and use you’ll need Node.JS installed first. With a new installation of Laravel 5 you’ll notice the file package.json in the root of your application.

You may automatically install the dependencies described in it with the following command:

$ npm install

Now that you have it installed, you can compile LESS, SASS, CoffeScript, trigger PHPUnit and PHPSpec tests and combine multiple sets of JS scripts.

NodeJS opens new horizons for your web development operations. It gives you such tools as Grunt and Gulp for task automation and a lot of other goodies to optimize your workflow.

Elixir is a Laravel wrapper for Gulp that gives you a prettier syntax for the task automation tool. With Elixir you can use SASS, LESS, CoffeeScript, PHPUnit and PHPSpec to make your life easier.

To install Gulp run the following command:

$ npm install gulp gulp-less gulp-sass gulp-phpunit gulp-phpspec

To use SASS, LESS or CoffeScript you have to put your .scss, .less or .coffee files in the corresponding subfolders in resources/assets – cofee/, less/ or sass/.

Then you can have a look at the gulpfile.js at the root of your Laravel application. Here you can describe the preprocessor files you’ll have compiled to regular CSS and Java Script directly into your public folder where your views are stored.

Here’s an example:

elixir(function(mix) {
mix.coffee('doppio.coffee')
mix.sass('sassy.scss')
 .phpUnit();
});

By running gulp, you’ll have those two turned into CSS and Java Script in no time and run your unit tests.

You can also run

$ gulp watch

in the background or set a cron job so that Elixir can update those for you each time a change is made to any of the files.

To install Socialite add

“laravel/socialite” : “~1.0”

to the require array in composer.json and run

$ composer install

Then to use it on GitHub you’ll need to obtaion the Client ID and the Client Secret, which is a set of strings you can obtain from their site so that your visitors can use their GitHub profies as logins to your Laravel application.

All these exciting new features are fully supported on all WebHostFace platforms and you can start testing them all with your account with us.

As a person interested in web development I find the news and horizons for Laravel 5 pretty exciting and I am sure that anyone that has been in touch with this framework will feel the same. How about all of you out there? Like what Laravel can offer or you have another favorite in mind? You can share your 2 cents in the comments below.

Cvetomir Denchev

Always willing to learn new concepts and skills not only in the area of Internet and computers. During his free time you can find him reading books on various topics and styles, at a concert, watching a flick from one of his favorite directors or travelling to different places (sometimes even hitchhiking).

Leave a Reply

Close Menu