Posted on March 18, 2015 | Written by Sarah Lofgren
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
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
“HTTP middleware provides a convenient mechanism for filtering HTTP requests entering your application.”
Separating Request/Response Logic from Application Logic
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 are a new type of class that handle validation and authorization for controllers and models. They are typically initiated via method injection.
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.
To use, set up a single CRON job that executes
->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.
.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.