SlideShare a Scribd company logo
Laravel 5 New Features
Joe Ferguson
Before we begin
Have Virtualbox (virtualbox.org) Installed
Have VirtualBox Extension Pack Installed
Have Vagrant (vagrantup.com) Installed
run: vagrant box add laravel/homestead
New Directory Structure
Laravel 5 Directory
App directory now "Your Application" / "Entry point to app”
Laravel 4 Artisan Commands -> Console in App folder
Web stuff in Http
Controllers all have name space
filters.php -> Broken out into separate classes/files.
More focus on Service Providers -> Filter Service Providers
No more global.php -> Use service providers
Removed models directory. Can be just in app folder. PSR-4 default
Don't like the app namespace? artisan app:name MyApplication
Blade Changes
Laravel 4 uses {{ to echo and {{{ To echo escaped
Laravel 5 {{ and {{{ will echo escaped and {!! is used to echo raw
Biggest impact is likely form helpers: {!! Form::open() !!}
Commands
Commands (app/Commands) - Message containing only info needed
to do something
Command Handler (app/Handlers/Commands) - Class that does
something in response to a command
Command Bus - Allows dispatch of commands, matches commands
to handlers
Self handling commands just need a handle() method on the
command & implements SelfHandling
Events
Events (app/Events)
Events have handlers (similar to Commands)
Bind Events via appProvidersEventServiceProvider.php
Events inform the system something happened VS demanding
action from the system
Form Requests
Special class for validating and authorizing form submissions
Each class has rules() (returns array) and authorize() (returns boolean) methods
Benefit of rules & authorize being methods is you can perform logic
Type Hinting your forms to the Form Request will automatically validate your
forms
If validation fails, errors will be available to the view and redirected back.
This happens because the FormRequestServiceProvider listens for anything being
resolved is instance of FormRequest and calls the validate method.
Helpers
view() - Get a View instance for the given view path
action() - Generate a URL for a given controller action
app_path() - Get the fully qualified path to the app directory
asset() - Generate a URL for an asset.
Routing – get(), delete(), put()
Route Caching
artisan route:cache
Serializes your routes.php
Benefits: Faster routing
Drawback: Must run artisan route:clear on every routes.php
change
Middleware
Implements decorator pattern. request -> does work -> returns object to next
layer
Laravel uses middleware for Encrypting/Decrypting cookies, Reading/Writing
Sessions
artisan make:middleware MyMiddleware (app/Http/Middleware)
Middleware registered in app/Http/Kernel.php
Can run before or after the request has been processed.
Easiest example would be auth
Controller Method Injection
Can inject dependencies into methods, no longer via constructor
Purpose is to help developers write cleaner code
Changes to Illuminate Packages
Form or HTML helpers no longer in Core, must be pulled in via
composer.
add "laravelcollective/html": "~5.0" to composer
update config/app.php
Elixir
API for defining basic Gulp tasks for your app.
Requires nodejs
Put your sass/less files in resources/assets/sass|less
Can trigger sass/less/phpunit/phpspec, combine stylesheets
Socialite
Easy to use social logins with oauth
Supports Facebook, Twitter, Google, Github, and Bitbucket
Contracts
Set of interfaces that define the core services provided by the
framework
Depend on abstractions, not concrete dependencies.
Write code that doesn't have to be aware of the laravel framework
Upgrade from 4.2 to 5
Fresh install Laravel 5
Update Dependencies /Packages
Namespace (somewhat optional for now)
Migrate environment variables
Move routes to app/Http/routes.php
Move controllers to app/Http/Controllers (add this to classmap)
Copy route bindings to boot() in app/Providers/RouteServiceProvider.php
Add route facade to RouteServiceProvider.php to continue using Route facade
CSRF is now global. Use middleware to disable if needed
Move models to app/Models. Add app/Models to classmap in composer.json
Update your user auth to use Laravel 5’s auth system
Move commands to app/Console/Commands. Add app/Console/Commands to classmap in composer.json
Move migrations to database/migrations, Database Seeds to database/seeds
… and more!
Upgrade from 4.2 to 5
http://laravel.com/docs/5.0/upgradeFresh install Laravel 5
Update Dependencies /Packages
Namespace (somewhat optional for now)
Migrate environment variables
Move routes to app/Http/routes.php
Move controllers to app/Http/Controllers (add this to classmap)
Copy route bindings to boot() in app/Providers/RouteServiceProvider.php
Add route facade to RouteServiceProvider.php to continue using Route facade
CSRF is now global. Use middleware to disable if needed
Move models to app/Models. Add app/Models to classmap in composer.json
Update your user auth to use Laravel 5’s auth system
Move commands to app/Console/Commands. Add app/Console/Commands to classmap in composer.json
Move migrations to database/migrations, Database Seeds to database/seeds
… and more!
Homestead
“Laravel Homestead is an official, pre-packaged
Vagrant "box" that provides you a wonderful
development environment without requiring you
to install PHP, HHVM, a web server, and any
other server software on your local machine. No
more worrying about messing up your operating
system! Vagrant boxes are completely disposable.
If something goes wrong, you can destroy and re-
create the box in minutes!”
What’s in the box:
• Ubuntu 14.04
• PHP 5.6
• HHVM
• Nginx
• MySQL
• Postgres
• Redis
• NodeJS
• Bower
• Grunt
• Gulp
• Beanstalkd
• Memcached
• Laravel Envoy
Fabric + HipChat Extension + more!
Getting Homestead
Install the box:
vagrant box add laravel/homestead
Getting Homestead
If you have PHP installed locally:
composer global require "laravel/homestead=~2.0"
Make sure to place the ~/.composer/vendor/bin directory in your
PATH so the homestead executable is found when you run the
homestead command in your terminal.
Homestead 2.0
Significant change over previous 1.x versions
Uses homestead from your home folder
Less vagrant stuff in your projects (if you don’t like that
sort of thing)
How I use Homestead
https://github.com/svpernova09/HomesteadSkeleton
Drop in Homestead files to project
Each project has an isolated vagrant environment
Easier to share dev environment settings

More Related Content

PDF
MidwestPHP 2016 - Adventures in Laravel 5
PDF
All the Laravel things: up and running to making $$
PDF
Knowing Laravel 5 : The most popular PHP framework
PDF
All Aboard for Laravel 5.1
PPTX
Laravel 5
PPT
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
PPTX
Intro to Laravel
PDF
Web Development with Laravel 5
MidwestPHP 2016 - Adventures in Laravel 5
All the Laravel things: up and running to making $$
Knowing Laravel 5 : The most popular PHP framework
All Aboard for Laravel 5.1
Laravel 5
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Intro to Laravel
Web Development with Laravel 5

What's hot (20)

PDF
Why Laravel?
PDF
Laravel 5.4
PPTX
Introduction to Laravel Framework (5.2)
PDF
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
PDF
All the Laravel Things – Up & Running to Making $$
PPTX
A introduction to Laravel framework
PPTX
What's New in Laravel 5 (Laravel Meetup - 23th Apr 15, Yogyakarta, ID)
PDF
Laravel Introduction
PDF
php[world] 2015 Laravel 5.1: From Homestead to the Cloud
PDF
php[world] 2015 Training - Laravel from the Ground Up
PDF
Laravel Forge: Hello World to Hello Production
PDF
What's New In Laravel 5
PPTX
10 Laravel packages everyone should know
PDF
Getting to know Laravel 5
ODP
Presentation laravel 5 4
PDF
Digpen 7: Why choose Laravel?
PPTX
Laravel overview
PPTX
Laravel Beginners Tutorial 1
PPTX
Workshop Laravel 5.2
PDF
Laravel Forge: Hello World to Hello Production
Why Laravel?
Laravel 5.4
Introduction to Laravel Framework (5.2)
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
All the Laravel Things – Up & Running to Making $$
A introduction to Laravel framework
What's New in Laravel 5 (Laravel Meetup - 23th Apr 15, Yogyakarta, ID)
Laravel Introduction
php[world] 2015 Laravel 5.1: From Homestead to the Cloud
php[world] 2015 Training - Laravel from the Ground Up
Laravel Forge: Hello World to Hello Production
What's New In Laravel 5
10 Laravel packages everyone should know
Getting to know Laravel 5
Presentation laravel 5 4
Digpen 7: Why choose Laravel?
Laravel overview
Laravel Beginners Tutorial 1
Workshop Laravel 5.2
Laravel Forge: Hello World to Hello Production
Ad

Viewers also liked (12)

PDF
From CakePHP to Laravel
PPTX
Laravel : A Fastest Growing Kid
PDF
Intro to Laravel 4
PDF
Laravel 5
PDF
Laravel 5
PPT
1 electronic data interchange (edi)
PPTX
Laravel 5 and SOLID
PPTX
Domain Driven Design using Laravel
PPT
ELECTRONIC DATA INTERCHANGE
PPTX
Advantages and Disadvantages of Technology
PDF
Introduction à Laravel 4 @Dogstudio
PDF
PHP 7.0 : aperçu des nouveautés
From CakePHP to Laravel
Laravel : A Fastest Growing Kid
Intro to Laravel 4
Laravel 5
Laravel 5
1 electronic data interchange (edi)
Laravel 5 and SOLID
Domain Driven Design using Laravel
ELECTRONIC DATA INTERCHANGE
Advantages and Disadvantages of Technology
Introduction à Laravel 4 @Dogstudio
PHP 7.0 : aperçu des nouveautés
Ad

Similar to Laravel 5 New Features (20)

PPTX
Getting started with laravel
PPTX
What-is-Laravel-23-August-2017.pptx
PPTX
Laravel introduction
PDF
Laravel 4 presentation
PPTX
What-is-Laravel and introduciton to Laravel
PPTX
Lecture 2_ Intro to laravel.pptx
ODP
Laravel 5.3 - Web Development Php framework
PPTX
Laravel Tutorial PPT
PPTX
Laravel 5
PDF
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
PPTX
Laravel
DOCX
Laravel
PDF
Laravel intake 37 all days
PPTX
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
PPTX
Laravel Meetup
PDF
laravel-interview-questions.pdf
PDF
Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)
PPT
Laravel & Composer presentation - extended
PPTX
Introduction to Laravel
PDF
Memphis php 01 22-13 - laravel basics
Getting started with laravel
What-is-Laravel-23-August-2017.pptx
Laravel introduction
Laravel 4 presentation
What-is-Laravel and introduciton to Laravel
Lecture 2_ Intro to laravel.pptx
Laravel 5.3 - Web Development Php framework
Laravel Tutorial PPT
Laravel 5
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
Laravel
Laravel
Laravel intake 37 all days
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel Meetup
laravel-interview-questions.pdf
Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)
Laravel & Composer presentation - extended
Introduction to Laravel
Memphis php 01 22-13 - laravel basics

More from Joe Ferguson (20)

PDF
Modern infrastructure as code with ansible cake fest 2021
PDF
Modern infrastructure as code with ansible PyTN
PDF
Slim PHP when you don't need the kitchen sink
PDF
Throwing Laravel into your Legacy App™
PDF
DevSpace Conf 2017 - Making sense of the provisioning circus
PDF
Release and-dependency-management memphis python
PDF
Composer at Scale, Release and Dependency Management
PDF
Put an end to regression with codeception testing
PDF
Midwest PHP 2017 DevOps For Small team
PDF
Console Apps: php artisan forthe:win
PDF
Console Apps: php artisan forthe:win
PDF
So You Just Inherited a $Legacy Application… NomadPHP July 2016
PDF
So You Just Inherited a $Legacy Application...
PDF
Acceptance & Functional Testing with Codeception - SunshinePHP 2016
PDF
Madison PHP 2015 - DevOps For Small Teams
PDF
ZendCon 2015 - DevOps for Small Teams
PDF
ZendCon 2015 - Laravel Forge: Hello World to Hello Production
PDF
Secure Form Processing and Protection - Devspace 2015
PDF
Acceptance & Functional Testing with Codeception - Devspace 2015
PDF
Continuous Integration: How I stopped guessing if that merge was bad
Modern infrastructure as code with ansible cake fest 2021
Modern infrastructure as code with ansible PyTN
Slim PHP when you don't need the kitchen sink
Throwing Laravel into your Legacy App™
DevSpace Conf 2017 - Making sense of the provisioning circus
Release and-dependency-management memphis python
Composer at Scale, Release and Dependency Management
Put an end to regression with codeception testing
Midwest PHP 2017 DevOps For Small team
Console Apps: php artisan forthe:win
Console Apps: php artisan forthe:win
So You Just Inherited a $Legacy Application… NomadPHP July 2016
So You Just Inherited a $Legacy Application...
Acceptance & Functional Testing with Codeception - SunshinePHP 2016
Madison PHP 2015 - DevOps For Small Teams
ZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - Laravel Forge: Hello World to Hello Production
Secure Form Processing and Protection - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015
Continuous Integration: How I stopped guessing if that merge was bad

Recently uploaded (20)

PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Modernizing your data center with Dell and AMD
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Cloud computing and distributed systems.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Spectral efficient network and resource selection model in 5G networks
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Big Data Technologies - Introduction.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Modernizing your data center with Dell and AMD
Understanding_Digital_Forensics_Presentation.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Cloud computing and distributed systems.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
NewMind AI Monthly Chronicles - July 2025
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...

Laravel 5 New Features

  • 1. Laravel 5 New Features Joe Ferguson
  • 2. Before we begin Have Virtualbox (virtualbox.org) Installed Have VirtualBox Extension Pack Installed Have Vagrant (vagrantup.com) Installed run: vagrant box add laravel/homestead
  • 4. Laravel 5 Directory App directory now "Your Application" / "Entry point to app” Laravel 4 Artisan Commands -> Console in App folder Web stuff in Http Controllers all have name space filters.php -> Broken out into separate classes/files. More focus on Service Providers -> Filter Service Providers No more global.php -> Use service providers Removed models directory. Can be just in app folder. PSR-4 default Don't like the app namespace? artisan app:name MyApplication
  • 5. Blade Changes Laravel 4 uses {{ to echo and {{{ To echo escaped Laravel 5 {{ and {{{ will echo escaped and {!! is used to echo raw Biggest impact is likely form helpers: {!! Form::open() !!}
  • 6. Commands Commands (app/Commands) - Message containing only info needed to do something Command Handler (app/Handlers/Commands) - Class that does something in response to a command Command Bus - Allows dispatch of commands, matches commands to handlers Self handling commands just need a handle() method on the command & implements SelfHandling
  • 7. Events Events (app/Events) Events have handlers (similar to Commands) Bind Events via appProvidersEventServiceProvider.php Events inform the system something happened VS demanding action from the system
  • 8. Form Requests Special class for validating and authorizing form submissions Each class has rules() (returns array) and authorize() (returns boolean) methods Benefit of rules & authorize being methods is you can perform logic Type Hinting your forms to the Form Request will automatically validate your forms If validation fails, errors will be available to the view and redirected back. This happens because the FormRequestServiceProvider listens for anything being resolved is instance of FormRequest and calls the validate method.
  • 9. Helpers view() - Get a View instance for the given view path action() - Generate a URL for a given controller action app_path() - Get the fully qualified path to the app directory asset() - Generate a URL for an asset. Routing – get(), delete(), put()
  • 10. Route Caching artisan route:cache Serializes your routes.php Benefits: Faster routing Drawback: Must run artisan route:clear on every routes.php change
  • 11. Middleware Implements decorator pattern. request -> does work -> returns object to next layer Laravel uses middleware for Encrypting/Decrypting cookies, Reading/Writing Sessions artisan make:middleware MyMiddleware (app/Http/Middleware) Middleware registered in app/Http/Kernel.php Can run before or after the request has been processed. Easiest example would be auth
  • 12. Controller Method Injection Can inject dependencies into methods, no longer via constructor Purpose is to help developers write cleaner code
  • 13. Changes to Illuminate Packages Form or HTML helpers no longer in Core, must be pulled in via composer. add "laravelcollective/html": "~5.0" to composer update config/app.php
  • 14. Elixir API for defining basic Gulp tasks for your app. Requires nodejs Put your sass/less files in resources/assets/sass|less Can trigger sass/less/phpunit/phpspec, combine stylesheets
  • 15. Socialite Easy to use social logins with oauth Supports Facebook, Twitter, Google, Github, and Bitbucket
  • 16. Contracts Set of interfaces that define the core services provided by the framework Depend on abstractions, not concrete dependencies. Write code that doesn't have to be aware of the laravel framework
  • 17. Upgrade from 4.2 to 5 Fresh install Laravel 5 Update Dependencies /Packages Namespace (somewhat optional for now) Migrate environment variables Move routes to app/Http/routes.php Move controllers to app/Http/Controllers (add this to classmap) Copy route bindings to boot() in app/Providers/RouteServiceProvider.php Add route facade to RouteServiceProvider.php to continue using Route facade CSRF is now global. Use middleware to disable if needed Move models to app/Models. Add app/Models to classmap in composer.json Update your user auth to use Laravel 5’s auth system Move commands to app/Console/Commands. Add app/Console/Commands to classmap in composer.json Move migrations to database/migrations, Database Seeds to database/seeds … and more!
  • 18. Upgrade from 4.2 to 5 http://laravel.com/docs/5.0/upgradeFresh install Laravel 5 Update Dependencies /Packages Namespace (somewhat optional for now) Migrate environment variables Move routes to app/Http/routes.php Move controllers to app/Http/Controllers (add this to classmap) Copy route bindings to boot() in app/Providers/RouteServiceProvider.php Add route facade to RouteServiceProvider.php to continue using Route facade CSRF is now global. Use middleware to disable if needed Move models to app/Models. Add app/Models to classmap in composer.json Update your user auth to use Laravel 5’s auth system Move commands to app/Console/Commands. Add app/Console/Commands to classmap in composer.json Move migrations to database/migrations, Database Seeds to database/seeds … and more!
  • 19. Homestead “Laravel Homestead is an official, pre-packaged Vagrant "box" that provides you a wonderful development environment without requiring you to install PHP, HHVM, a web server, and any other server software on your local machine. No more worrying about messing up your operating system! Vagrant boxes are completely disposable. If something goes wrong, you can destroy and re- create the box in minutes!”
  • 20. What’s in the box: • Ubuntu 14.04 • PHP 5.6 • HHVM • Nginx • MySQL • Postgres • Redis • NodeJS • Bower • Grunt • Gulp • Beanstalkd • Memcached • Laravel Envoy Fabric + HipChat Extension + more!
  • 21. Getting Homestead Install the box: vagrant box add laravel/homestead
  • 22. Getting Homestead If you have PHP installed locally: composer global require "laravel/homestead=~2.0" Make sure to place the ~/.composer/vendor/bin directory in your PATH so the homestead executable is found when you run the homestead command in your terminal.
  • 23. Homestead 2.0 Significant change over previous 1.x versions Uses homestead from your home folder Less vagrant stuff in your projects (if you don’t like that sort of thing)
  • 24. How I use Homestead https://github.com/svpernova09/HomesteadSkeleton Drop in Homestead files to project Each project has an isolated vagrant environment Easier to share dev environment settings