What’s New in Laravel 5

Whats-new-in-laravel-5

We held a Meetup at the office last week for local developers to get together and explore new options available in Laravel 5. I’ve included our head developer’s (Michael’s) notes from our meeting below, so you can also take a peek into what’s coming up with this release.  Looking for more information about our Laravel Developer Services, head over to our main site.

What’s New in Laravel 5

Some Backstory

Laravel 5.0 was released on February 4th, 2015. It was intitially set to release as version 4.3 last year, but as new coding practices began to reshape the application structure and logic, it was bumped to a new release.

Structure and Application Namespacing

Comparing Directory Structures

2015-03-05-seattle-laravel-meetup

Application Namespacing

2015-03-05-seattle-laravel-meetup 2

Middleware

“HTTP middleware provides a convenient mechanism for filtering HTTP requests entering your application.”

Separating Request/Response Logic from Application Logic

2015-03-05-seattle-laravel-meetup 3

Does Middleware Replace Filters?

No. Filters are still available in Laravel 5, however the layer pattern of Middleware makes request handling simpler and cleaner.

Form Requests

Form Requests are a new type of class that handle validation and authorization for controllers and models. They are typically initiated via method injection.

Scheduler

In the past, Laravel has provided Commands for running CLI tasks. With Scheduler, you no longer need to set individual CRON jobs for your tasks.

2015-03-05-seattle-laravel-meetup 4

To use, set up a single CRON job that executes

artisan schedule:run

Scheduling Methods

• ->hourly()
• ->daily()
• ->at($time) // 24 hour time
• ->dailyAt($time)
• ->twiceDaily()
• ->weekdays()
• ->mondays()
• ->tuesdays()
• ->wednesdays()
• ->thursdays()
• ->fridays()
• ->saturdays()
• ->sundays()
• ->weekly()
• ->weeklyOn($day, $time)
• ->monthly()
• ->yearly()
• ->everyFiveMinutes()
• ->everyTenMinutes()
• ->everyThirtyMinutes()
• ->days() // Days of the week.

Note: Scheduler is an extension of the Dispatch package for L4.

Artisan and Package Creation

In addition to new generators, the scheduler and command handlers, L5 has dropped package creation with Workbench.

The End of Workbench

Laravel no longer ships with package scaffolding. Instead, developers will need to create their packages as stand-alone composer packages. Unlike Workbench, the composer approach forces developers to consider their code in a platform-agnostic manner. Packages can still have Laravel-specific logic, such as Facades, Views and Routes.

DotEnv

.env files allow for sensitive information, such as API keys, to be stored externally of configuration files. L5 makes use of DotEnv to allow for global environment specific variables.

Flysystem and Cloud Storage

The new filesystem adopts an abstraction of the Flysystem by Frank de Jonge. In addition to the normal filesystem from L4, L5 allows for cloud storage with various drivers.

Elixr

“Laravel Elixir provides a clean, fluent API for defining basic Gulp tasks for your Laravel application. Elixir supports several common CSS and JavaScript pre-processors and even testing tools.”

 

The team meets with other local developers to talk Laravel 5

The cbw team meets with other local developers to talk Laravel 5

 

Sarah has been with coolblueweb since 2012. She enjoys dance, movies and laughing at inappropriate times.