SlideShare a Scribd company logo
1 of 64
Download to read offline
All Aboard for Laravel 5.1
Jason McCreary
"JMac"
@gonedark
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
A short rant about frameworks
Choose wisely and code carefully
2
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Talk the Talk
1. What’s New in Laravel 5.0
2. Upgrading from Laravel 4.2
3. What’s New in Laravel 5.1
4. What’s coming in Laravel 5.2
3
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
The Goal
“To get you familiar with the new features in Laravel so
you are comfortable upgrading your projects to 5.1”
4
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Why Upgrade?
“Laravel 5.1 is the first release of Laravel to receive
long term support. Laravel 5.1 will receive bug fixes
for 2 years and security fixes for 3 years.This support
window is the largest ever provided for Laravel and
provides stability and peace of mind for larger,
enterprise clients and customers.”
5
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
What’s New…
In Laravel 5.0
6
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
New Folder Structure
• Follows PSR-4 naming conventions
• App namespacing
• Models live in the default namespace
• Everything related to HTTP lives under Http/
(controllers, middleware, requests)
• Views live outside the App namespace within
resources/.
7
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Folder Structure
8
4.2 5.0
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
App Folder
9
4.2 5.0
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Namespacing
<?php namespace App;



// ...


class User extends Model {

// ...

}
10
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Namespacing
<?php namespace AppHttpControllers;



class HomeController extends Controller {


public function index()

{

return view('home');

}

}
11
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Namespacing
"autoload": {

"classmap": [

"app/commands",

"app/controllers",

"app/models",

"app/database/migrations",

"app/database/seeds",

"app/tests/TestCase.php"

]

},
12
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App": "app/"
}
},
4.2 5.0
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
New Objects
• Events are now objects, not strings!
• Command objects allow simpler job processing
• Requests are now objects
• Middleware objects to replace Filters
13
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Middleware
“HTTP middleware provide a convenient mechanism
for filtering HTTP requests entering your application.”
14
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Middleware
<?php namespace AppHttpControllers;



class HomeController extends Controller {

public function __construct()

{

$this->middleware('auth');

}
// ...

}
15
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Middleware
<?php namespace AppHttpMiddleware;
use Closure;
class TimeoutMiddleware {
public function handle($request, Closure $next) {
if (abs(time() - $request->input(‘ttl’)) > 300) {
return redirect('timeout');
}
return $next($request);
}
}
16
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Form Request Objects
“A simple way to customize request validation
automatically.”
17
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Form Request Objects
<?php namespace AppHttpRequests;
class RegisterRequest extends FormRequest {
public function rules() {
return [
'email' => 'required|email|unique:users',
'password' => 'required|confirmed|min:8'
];
}
}
18
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Controller Method Injection
“In addition to constructor injection, you may now
type-hint dependencies on controller methods. These
objects will be resolved and available along with any
route parameters.”
19
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Controller Method Injection
public function register(
RegisterRequest $request,
RegistrationRepository $registration)
{
// ...
}
20
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
ControllerValidation
"If FormRequests are a little too much, the Laravel 5
base controller now includes a
ValidatesRequests trait.This trait provides a
simple validate() method to validate incoming
requests."
21
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
ControllerValidation
public function register(Request $request)
{
$this->validate($request, [
'email' => 'required|email|unique:users',
'password' => 'required|confirmed|min:8'
]);
}
22
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Environment Configuration
“Laravel 5 uses the DotEnv library to condense all
configuration values into a single .env file. These
values get loaded into $_ENV and available through the
env() helper method.”
23
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Environment Configuration
APP_ENV=local

APP_DEBUG=true

APP_KEY=SomeRandomString



DB_HOST=localhost

DB_DATABASE=homestead

DB_USERNAME=homestead

DB_PASSWORD=secret



CACHE_DRIVER=file

SESSION_DRIVER=file
24
<?php
return array(
'APP_KEY' => 'secretkey',
);
4.2 5.0
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Environment Configuration
25
<?php



return [


'debug' => env('APP_DEBUG'),

// ...


'key' => env('APP_KEY', 'SomeRandomString'),



// ...

];
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Artisan Updates
• Now includes several make commands to generate
common objects
• tinker is now backed by Psysh for a more powerful
REPL
• route commands for listing and caching routes
26
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Authentication
“User registration, authentication, and password reset
controllers are now included out of the box, as well as
simple corresponding views.”
27
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
User Model (4.2)
<?php



use IlluminateAuthUserTrait;

use IlluminateAuthUserInterface;

use IlluminateAuthRemindersRemindableTrait;

use IlluminateAuthRemindersRemindableInterface;



class User extends Eloquent implements UserInterface,
RemindableInterface {



use UserTrait, RemindableTrait;



protected $table = 'users';

protected $hidden = array('password', 'remember_token');

}
28
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
User Model (5.0)
<?php namespace App;



use IlluminateAuthAuthenticatable;

use IlluminateDatabaseEloquentModel;

use IlluminateAuthPasswordsCanResetPassword;

use IlluminateContractsAuthAuthenticatable as AuthenticatableContract;

use IlluminateContractsAuthCanResetPassword as
CanResetPasswordContract;



class User extends Model implements AuthenticatableContract,
CanResetPasswordContract {



use Authenticatable, CanResetPassword;



protected $table = 'users';

protected $fillable = ['name', 'email', 'password'];

protected $hidden = ['password', 'remember_token'];

}
29
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Blade
“By default, Laravel 5.0 escapes all output from both
the {{ }} and {{{ }}} Blade directives. A new
{!! !!} directive has been introduced to display raw,
unescaped output.”
30
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Libraries and Packages
• Laravel Elixir - asset management
• Laravel Socialite - authentication with Oauth services
• Flysystem - filesystem abstraction library
• Laravel Scheduler - command manager
31
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Upgrading Laravel
From 4.2 to 5.0
32
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Two Approaches
• “New move-in”
• “Update in-place”
33
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
What to do?
“As always, it depends. However, the documentation
recommends migrating your 4.2 app to a new Laravel 5
app. So, new move-in it is.”
34
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Basic Steps
1. Create a new Laravel 5 app
2. Migrate configuration
3. Move app files
4. Add namespacing
5. Review Bindings
6. Miscellaneous changes
7. Blade Tag changes
8. Update dependencies
9. Cross fingers
35
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Do not pass 5.0!
“Going directly to 5.1 will make the migration more
complicated as there are significant changes between
5.0 and 5.1. Do not pass 5.0. Otherwise you will not
collect $200 and you will go to jail.”
36
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Create new Laravel 5 app
composer create-project laravel/laravel --prefer-dist
37
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Create new Laravel 5 app
composer global require “laravel/installer=~1.1”
laravel new project-name
38
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Migrate Configuration
1. Copy configuration from your 4.2 app’s env.php
to .env
2. Compare configurations from your 4.2 app’s
config/
3. Recreate environment configurations from your 4.2
app’s config/env/ to.env
4. Update environment configurations to use env()
39
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Migrate Configuration
“Be sure to leave .env.example file in your project.
It should contain placeholder values that will make it
easy for other developers to copy and configure for
their environment.”
40
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Migrate Configuration
“When managing multiple environments, you may find it
easiest to create several .env files and symlink
the .env within each environment.”
41
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Move Files
42
4.2 5.0
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Move Files
• routes.php to app/Http/routes.php
• app/views to resources/views
• app/database to database/
43
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Add namespace
“You do not need to do this.You can keep everything in
the global namespace and add the paths to the
classmap just as in Laravel 4.2. However, not doing
so carries over technical debt as your project will not
truly follow Laravel 5.0’s configuration.”
44
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Add namespace
<?php namespace AppHttpControllers;



class YourController extends Controller {
// ...

}

45
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Add namespace
<?php namespace App;



class YourModel extends Eloquent {
// ...

}

46
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Review Bindings
"Move any service container bindings from start/
global.php to the register method of the app/
Providers/AppServiceProvider.php file."
47
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Miscellaneous Changes
•SoftDeletingTrait is now SoftDeletes
•User Authentication changes
•Pagination method changes
•Oh yeah, and the Form and Html Facades are gone.
48
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Blade Changes
1. Cry
2. Bargain
3. Face reality
4. Start changing every {{ }} to {!! !!}
5. Remove all blade comment tags {{-- --}} (you
should have known better)
6. Smile
49
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Update your dependencies
"Review your dependencies then run composer
update"
50
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Cross fingers
51
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 201552
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Questions…
Ask now! Cause we’re moving to 5.1
53
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
What’s New…
In Laravel 5.1
54
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Project Updates
• Long Term Support
• Requires PHP > 5.5.9
• Follows PSR-2
• Updated Documentation
• Uses openssl for encryption, instead of mcrypt
55
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
App Folder
56
5.0 5.1
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Event Broadcasting
"makes it easy to broadcast your events over a
websocket connection."
57
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Middleware Parameters
<?php namespace AppHttpMiddleware;
use Closure;
class RoleMiddleware {
public function handle($request, Closure $next, $role) {
if (!$request->user()->hasRole($role)) {
// Redirect...
}
return $next($request);
}
}
58
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Middleware Parameters
Route::put(
‘post/{id}',
['middleware' => 'role:editor', function ($id) {
// ...
}]
);
59
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Focus on Testing
• Stronger integration testing
• Model factories
60
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
What’s Coming…
In Laravel 5.2
61
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Laravel 5.2
• Coming December 2015
• Route filters have been deprecated in preference of
middleware.
• *_fetch methods deprecated in favor of *_pluck
62
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Resources
• What’s new in Laravel 5 Laracasts
• Laravel Official Upgrade Guide
• Laravel In-Place Upgrade Guide
• What’s new in Laravel 5.1 Laracasts
63
All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015
Questions…
@gonedark on Twitter
64

More Related Content

What's hot

Web Development with Laravel 5
Web Development with Laravel 5Web Development with Laravel 5
Web Development with Laravel 5Soheil Khodayari
 
From CakePHP to Laravel
From CakePHP to LaravelFrom CakePHP to Laravel
From CakePHP to LaravelJason McCreary
 
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
Adventures in Laravel 5 SunshinePHP 2016 TutorialAdventures in Laravel 5 SunshinePHP 2016 Tutorial
Adventures in Laravel 5 SunshinePHP 2016 TutorialJoe Ferguson
 
Digpen 7: Why choose Laravel?
Digpen 7: Why choose Laravel?Digpen 7: Why choose Laravel?
Digpen 7: Why choose Laravel?John Blackmore
 
A introduction to Laravel framework
A introduction to Laravel frameworkA introduction to Laravel framework
A introduction to Laravel frameworkPhu Luong Trong
 
Getting to know Laravel 5
Getting to know Laravel 5Getting to know Laravel 5
Getting to know Laravel 5Bukhori Aqid
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5Darren Craig
 
10 Laravel packages everyone should know
10 Laravel packages everyone should know10 Laravel packages everyone should know
10 Laravel packages everyone should knowPovilas Korop
 
Projects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 ProjectsProjects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 ProjectsSam Dias
 
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Dilouar Hossain
 
Laravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web ArtisansLaravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web ArtisansWindzoon Technologies
 
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin Lorvent56
 
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)daylerees
 
All the Laravel Things – Up & Running to Making $$
All the Laravel Things – Up & Running to Making $$All the Laravel Things – Up & Running to Making $$
All the Laravel Things – Up & Running to Making $$Joe Ferguson
 
php[world] 2015 Training - Laravel from the Ground Up
php[world] 2015 Training - Laravel from the Ground Upphp[world] 2015 Training - Laravel from the Ground Up
php[world] 2015 Training - Laravel from the Ground UpJoe Ferguson
 

What's hot (20)

Web Development with Laravel 5
Web Development with Laravel 5Web Development with Laravel 5
Web Development with Laravel 5
 
From CakePHP to Laravel
From CakePHP to LaravelFrom CakePHP to Laravel
From CakePHP to Laravel
 
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
Adventures in Laravel 5 SunshinePHP 2016 TutorialAdventures in Laravel 5 SunshinePHP 2016 Tutorial
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
 
Digpen 7: Why choose Laravel?
Digpen 7: Why choose Laravel?Digpen 7: Why choose Laravel?
Digpen 7: Why choose Laravel?
 
Intro to Laravel
Intro to LaravelIntro to Laravel
Intro to Laravel
 
A introduction to Laravel framework
A introduction to Laravel frameworkA introduction to Laravel framework
A introduction to Laravel framework
 
Laravel 5.4
Laravel 5.4 Laravel 5.4
Laravel 5.4
 
Getting to know Laravel 5
Getting to know Laravel 5Getting to know Laravel 5
Getting to know Laravel 5
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5
 
Laravel Introduction
Laravel IntroductionLaravel Introduction
Laravel Introduction
 
10 Laravel packages everyone should know
10 Laravel packages everyone should know10 Laravel packages everyone should know
10 Laravel packages everyone should know
 
Hack the Future
Hack the FutureHack the Future
Hack the Future
 
Projects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 ProjectsProjects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 Projects
 
Laravel overview
Laravel overviewLaravel overview
Laravel overview
 
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
 
Laravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web ArtisansLaravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web Artisans
 
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
 
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
 
All the Laravel Things – Up & Running to Making $$
All the Laravel Things – Up & Running to Making $$All the Laravel Things – Up & Running to Making $$
All the Laravel Things – Up & Running to Making $$
 
php[world] 2015 Training - Laravel from the Ground Up
php[world] 2015 Training - Laravel from the Ground Upphp[world] 2015 Training - Laravel from the Ground Up
php[world] 2015 Training - Laravel from the Ground Up
 

Viewers also liked

Laravel Webcon 2015
Laravel Webcon 2015Laravel Webcon 2015
Laravel Webcon 2015Tim Bracken
 
Amp your site an intro to accelerated mobile pages
Amp your site  an intro to accelerated mobile pagesAmp your site  an intro to accelerated mobile pages
Amp your site an intro to accelerated mobile pagesRobert McFrazier
 
Zend Framework Foundations
Zend Framework FoundationsZend Framework Foundations
Zend Framework FoundationsChuck Reeves
 
Adding 1.21 Gigawatts to Applications with RabbitMQ (Bulgaria PHP 2016 - Tuto...
Adding 1.21 Gigawatts to Applications with RabbitMQ (Bulgaria PHP 2016 - Tuto...Adding 1.21 Gigawatts to Applications with RabbitMQ (Bulgaria PHP 2016 - Tuto...
Adding 1.21 Gigawatts to Applications with RabbitMQ (Bulgaria PHP 2016 - Tuto...James Titcumb
 
Console Apps: php artisan forthe:win
Console Apps: php artisan forthe:win Console Apps: php artisan forthe:win
Console Apps: php artisan forthe:win Joe Ferguson
 
Dip Your Toes in the Sea of Security
Dip Your Toes in the Sea of SecurityDip Your Toes in the Sea of Security
Dip Your Toes in the Sea of SecurityJames Titcumb
 
Code Coverage for Total Security in Application Migrations
Code Coverage for Total Security in Application MigrationsCode Coverage for Total Security in Application Migrations
Code Coverage for Total Security in Application MigrationsDana Luther
 
Presentation Bulgaria PHP
Presentation Bulgaria PHPPresentation Bulgaria PHP
Presentation Bulgaria PHPAlena Holligan
 
SunshinePHP 2017 - Making the most out of MySQL
SunshinePHP 2017 - Making the most out of MySQLSunshinePHP 2017 - Making the most out of MySQL
SunshinePHP 2017 - Making the most out of MySQLGabriela Ferrara
 
PHP World DC 2015 - What Can Go Wrong with Agile Development and How to Fix It
PHP World DC 2015 - What Can Go Wrong with Agile Development and How to Fix ItPHP World DC 2015 - What Can Go Wrong with Agile Development and How to Fix It
PHP World DC 2015 - What Can Go Wrong with Agile Development and How to Fix ItMatt Toigo
 
Intermediate OOP in PHP
Intermediate OOP in PHPIntermediate OOP in PHP
Intermediate OOP in PHPDavid Stockton
 
Enough suffering, fix your architecture!
Enough suffering, fix your architecture!Enough suffering, fix your architecture!
Enough suffering, fix your architecture!Luís Cobucci
 

Viewers also liked (20)

Laravel Webcon 2015
Laravel Webcon 2015Laravel Webcon 2015
Laravel Webcon 2015
 
Laravel 5
Laravel 5Laravel 5
Laravel 5
 
Amp your site an intro to accelerated mobile pages
Amp your site  an intro to accelerated mobile pagesAmp your site  an intro to accelerated mobile pages
Amp your site an intro to accelerated mobile pages
 
Zend Framework Foundations
Zend Framework FoundationsZend Framework Foundations
Zend Framework Foundations
 
Create, test, secure, repeat
Create, test, secure, repeatCreate, test, secure, repeat
Create, test, secure, repeat
 
Adding 1.21 Gigawatts to Applications with RabbitMQ (Bulgaria PHP 2016 - Tuto...
Adding 1.21 Gigawatts to Applications with RabbitMQ (Bulgaria PHP 2016 - Tuto...Adding 1.21 Gigawatts to Applications with RabbitMQ (Bulgaria PHP 2016 - Tuto...
Adding 1.21 Gigawatts to Applications with RabbitMQ (Bulgaria PHP 2016 - Tuto...
 
Engineer - Mastering the Art of Software
Engineer - Mastering the Art of SoftwareEngineer - Mastering the Art of Software
Engineer - Mastering the Art of Software
 
Git Empowered
Git EmpoweredGit Empowered
Git Empowered
 
Console Apps: php artisan forthe:win
Console Apps: php artisan forthe:win Console Apps: php artisan forthe:win
Console Apps: php artisan forthe:win
 
Dip Your Toes in the Sea of Security
Dip Your Toes in the Sea of SecurityDip Your Toes in the Sea of Security
Dip Your Toes in the Sea of Security
 
Code Coverage for Total Security in Application Migrations
Code Coverage for Total Security in Application MigrationsCode Coverage for Total Security in Application Migrations
Code Coverage for Total Security in Application Migrations
 
Presentation Bulgaria PHP
Presentation Bulgaria PHPPresentation Bulgaria PHP
Presentation Bulgaria PHP
 
Php extensions
Php extensionsPhp extensions
Php extensions
 
Conscious Coupling
Conscious CouplingConscious Coupling
Conscious Coupling
 
SunshinePHP 2017 - Making the most out of MySQL
SunshinePHP 2017 - Making the most out of MySQLSunshinePHP 2017 - Making the most out of MySQL
SunshinePHP 2017 - Making the most out of MySQL
 
PHP World DC 2015 - What Can Go Wrong with Agile Development and How to Fix It
PHP World DC 2015 - What Can Go Wrong with Agile Development and How to Fix ItPHP World DC 2015 - What Can Go Wrong with Agile Development and How to Fix It
PHP World DC 2015 - What Can Go Wrong with Agile Development and How to Fix It
 
200K+ reasons security is a must
200K+ reasons security is a must200K+ reasons security is a must
200K+ reasons security is a must
 
Modern sql
Modern sqlModern sql
Modern sql
 
Intermediate OOP in PHP
Intermediate OOP in PHPIntermediate OOP in PHP
Intermediate OOP in PHP
 
Enough suffering, fix your architecture!
Enough suffering, fix your architecture!Enough suffering, fix your architecture!
Enough suffering, fix your architecture!
 

Similar to All Aboard for Laravel 5.1

Testing your application on Google App Engine
Testing your application on Google App EngineTesting your application on Google App Engine
Testing your application on Google App EngineInphina Technologies
 
Testing Your Application On Google App Engine
Testing Your Application On Google App EngineTesting Your Application On Google App Engine
Testing Your Application On Google App EngineIndicThreads
 
DevOps in PHP environment
DevOps in PHP environment DevOps in PHP environment
DevOps in PHP environment Evaldo Felipe
 
RichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile DevicesRichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile DevicesPavol Pitoňák
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php PresentationAlan Pinstein
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetAchieve Internet
 
Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh VariaCloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh VariaAmazon Web Services
 
Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Pavel Kaminsky
 
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...Jesse Gallagher
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new buildIgor Khotin
 
Building Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in RailsBuilding Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in RailsJim Jeffers
 
Sinatra and friends
Sinatra and friendsSinatra and friends
Sinatra and friendsJiang Wu
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applicationschartjes
 
Enterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudEnterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudCarlos Sanchez
 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207patter
 

Similar to All Aboard for Laravel 5.1 (20)

Laravel 5.5 dev
Laravel 5.5 devLaravel 5.5 dev
Laravel 5.5 dev
 
Testing your application on Google App Engine
Testing your application on Google App EngineTesting your application on Google App Engine
Testing your application on Google App Engine
 
Testing Your Application On Google App Engine
Testing Your Application On Google App EngineTesting Your Application On Google App Engine
Testing Your Application On Google App Engine
 
DevOps in PHP environment
DevOps in PHP environment DevOps in PHP environment
DevOps in PHP environment
 
Pyramid deployment
Pyramid deploymentPyramid deployment
Pyramid deployment
 
RichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile DevicesRichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile Devices
 
Laravel intallation
Laravel intallationLaravel intallation
Laravel intallation
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh VariaCloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
 
Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments
 
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new build
 
Exploring Maven SVN GIT
Exploring Maven SVN GITExploring Maven SVN GIT
Exploring Maven SVN GIT
 
Maven
MavenMaven
Maven
 
Building Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in RailsBuilding Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in Rails
 
Sinatra and friends
Sinatra and friendsSinatra and friends
Sinatra and friends
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applications
 
Enterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudEnterprise Build And Test In The Cloud
Enterprise Build And Test In The Cloud
 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207
 

More from Jason McCreary

Patterns, Code Smells, and The Pragmattic Programmer
Patterns, Code Smells, and The Pragmattic ProgrammerPatterns, Code Smells, and The Pragmattic Programmer
Patterns, Code Smells, and The Pragmattic ProgrammerJason McCreary
 
Cache, Workers, and Queues
Cache, Workers, and QueuesCache, Workers, and Queues
Cache, Workers, and QueuesJason McCreary
 
21 Ways to Make WordPress Fast
21 Ways to Make WordPress Fast21 Ways to Make WordPress Fast
21 Ways to Make WordPress FastJason McCreary
 
21 Ways to Make WordPress Fast
21 Ways to Make WordPress Fast21 Ways to Make WordPress Fast
21 Ways to Make WordPress FastJason McCreary
 
Configuring WordPress for Multiple Environments
Configuring WordPress for Multiple EnvironmentsConfiguring WordPress for Multiple Environments
Configuring WordPress for Multiple EnvironmentsJason McCreary
 

More from Jason McCreary (6)

BDD in iOS with Cedar
BDD in iOS with CedarBDD in iOS with Cedar
BDD in iOS with Cedar
 
Patterns, Code Smells, and The Pragmattic Programmer
Patterns, Code Smells, and The Pragmattic ProgrammerPatterns, Code Smells, and The Pragmattic Programmer
Patterns, Code Smells, and The Pragmattic Programmer
 
Cache, Workers, and Queues
Cache, Workers, and QueuesCache, Workers, and Queues
Cache, Workers, and Queues
 
21 Ways to Make WordPress Fast
21 Ways to Make WordPress Fast21 Ways to Make WordPress Fast
21 Ways to Make WordPress Fast
 
21 Ways to Make WordPress Fast
21 Ways to Make WordPress Fast21 Ways to Make WordPress Fast
21 Ways to Make WordPress Fast
 
Configuring WordPress for Multiple Environments
Configuring WordPress for Multiple EnvironmentsConfiguring WordPress for Multiple Environments
Configuring WordPress for Multiple Environments
 

Recently uploaded

Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作ys8omjxb
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Excelmac1
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Lucknow
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa494f574xmv
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 

Recently uploaded (20)

Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 

All Aboard for Laravel 5.1

  • 1. All Aboard for Laravel 5.1 Jason McCreary "JMac" @gonedark
  • 2. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 A short rant about frameworks Choose wisely and code carefully 2
  • 3. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Talk the Talk 1. What’s New in Laravel 5.0 2. Upgrading from Laravel 4.2 3. What’s New in Laravel 5.1 4. What’s coming in Laravel 5.2 3
  • 4. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 The Goal “To get you familiar with the new features in Laravel so you are comfortable upgrading your projects to 5.1” 4
  • 5. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Why Upgrade? “Laravel 5.1 is the first release of Laravel to receive long term support. Laravel 5.1 will receive bug fixes for 2 years and security fixes for 3 years.This support window is the largest ever provided for Laravel and provides stability and peace of mind for larger, enterprise clients and customers.” 5
  • 6. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 What’s New… In Laravel 5.0 6
  • 7. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 New Folder Structure • Follows PSR-4 naming conventions • App namespacing • Models live in the default namespace • Everything related to HTTP lives under Http/ (controllers, middleware, requests) • Views live outside the App namespace within resources/. 7
  • 8. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Folder Structure 8 4.2 5.0
  • 9. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 App Folder 9 4.2 5.0
  • 10. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Namespacing <?php namespace App;
 
 // ... 
 class User extends Model {
 // ...
 } 10
  • 11. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Namespacing <?php namespace AppHttpControllers;
 
 class HomeController extends Controller { 
 public function index()
 {
 return view('home');
 }
 } 11
  • 12. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Namespacing "autoload": {
 "classmap": [
 "app/commands",
 "app/controllers",
 "app/models",
 "app/database/migrations",
 "app/database/seeds",
 "app/tests/TestCase.php"
 ]
 }, 12 "autoload": { "classmap": [ "database" ], "psr-4": { "App": "app/" } }, 4.2 5.0
  • 13. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 New Objects • Events are now objects, not strings! • Command objects allow simpler job processing • Requests are now objects • Middleware objects to replace Filters 13
  • 14. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Middleware “HTTP middleware provide a convenient mechanism for filtering HTTP requests entering your application.” 14
  • 15. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Middleware <?php namespace AppHttpControllers;
 
 class HomeController extends Controller {
 public function __construct()
 {
 $this->middleware('auth');
 } // ...
 } 15
  • 16. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Middleware <?php namespace AppHttpMiddleware; use Closure; class TimeoutMiddleware { public function handle($request, Closure $next) { if (abs(time() - $request->input(‘ttl’)) > 300) { return redirect('timeout'); } return $next($request); } } 16
  • 17. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Form Request Objects “A simple way to customize request validation automatically.” 17
  • 18. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Form Request Objects <?php namespace AppHttpRequests; class RegisterRequest extends FormRequest { public function rules() { return [ 'email' => 'required|email|unique:users', 'password' => 'required|confirmed|min:8' ]; } } 18
  • 19. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Controller Method Injection “In addition to constructor injection, you may now type-hint dependencies on controller methods. These objects will be resolved and available along with any route parameters.” 19
  • 20. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Controller Method Injection public function register( RegisterRequest $request, RegistrationRepository $registration) { // ... } 20
  • 21. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 ControllerValidation "If FormRequests are a little too much, the Laravel 5 base controller now includes a ValidatesRequests trait.This trait provides a simple validate() method to validate incoming requests." 21
  • 22. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 ControllerValidation public function register(Request $request) { $this->validate($request, [ 'email' => 'required|email|unique:users', 'password' => 'required|confirmed|min:8' ]); } 22
  • 23. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Environment Configuration “Laravel 5 uses the DotEnv library to condense all configuration values into a single .env file. These values get loaded into $_ENV and available through the env() helper method.” 23
  • 24. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Environment Configuration APP_ENV=local
 APP_DEBUG=true
 APP_KEY=SomeRandomString
 
 DB_HOST=localhost
 DB_DATABASE=homestead
 DB_USERNAME=homestead
 DB_PASSWORD=secret
 
 CACHE_DRIVER=file
 SESSION_DRIVER=file 24 <?php return array( 'APP_KEY' => 'secretkey', ); 4.2 5.0
  • 25. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Environment Configuration 25 <?php
 
 return [ 
 'debug' => env('APP_DEBUG'),
 // ... 
 'key' => env('APP_KEY', 'SomeRandomString'),
 
 // ...
 ];
  • 26. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Artisan Updates • Now includes several make commands to generate common objects • tinker is now backed by Psysh for a more powerful REPL • route commands for listing and caching routes 26
  • 27. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Authentication “User registration, authentication, and password reset controllers are now included out of the box, as well as simple corresponding views.” 27
  • 28. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 User Model (4.2) <?php
 
 use IlluminateAuthUserTrait;
 use IlluminateAuthUserInterface;
 use IlluminateAuthRemindersRemindableTrait;
 use IlluminateAuthRemindersRemindableInterface;
 
 class User extends Eloquent implements UserInterface, RemindableInterface {
 
 use UserTrait, RemindableTrait;
 
 protected $table = 'users';
 protected $hidden = array('password', 'remember_token');
 } 28
  • 29. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 User Model (5.0) <?php namespace App;
 
 use IlluminateAuthAuthenticatable;
 use IlluminateDatabaseEloquentModel;
 use IlluminateAuthPasswordsCanResetPassword;
 use IlluminateContractsAuthAuthenticatable as AuthenticatableContract;
 use IlluminateContractsAuthCanResetPassword as CanResetPasswordContract;
 
 class User extends Model implements AuthenticatableContract, CanResetPasswordContract {
 
 use Authenticatable, CanResetPassword;
 
 protected $table = 'users';
 protected $fillable = ['name', 'email', 'password'];
 protected $hidden = ['password', 'remember_token'];
 } 29
  • 30. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Blade “By default, Laravel 5.0 escapes all output from both the {{ }} and {{{ }}} Blade directives. A new {!! !!} directive has been introduced to display raw, unescaped output.” 30
  • 31. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Libraries and Packages • Laravel Elixir - asset management • Laravel Socialite - authentication with Oauth services • Flysystem - filesystem abstraction library • Laravel Scheduler - command manager 31
  • 32. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Upgrading Laravel From 4.2 to 5.0 32
  • 33. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Two Approaches • “New move-in” • “Update in-place” 33
  • 34. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 What to do? “As always, it depends. However, the documentation recommends migrating your 4.2 app to a new Laravel 5 app. So, new move-in it is.” 34
  • 35. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Basic Steps 1. Create a new Laravel 5 app 2. Migrate configuration 3. Move app files 4. Add namespacing 5. Review Bindings 6. Miscellaneous changes 7. Blade Tag changes 8. Update dependencies 9. Cross fingers 35
  • 36. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Do not pass 5.0! “Going directly to 5.1 will make the migration more complicated as there are significant changes between 5.0 and 5.1. Do not pass 5.0. Otherwise you will not collect $200 and you will go to jail.” 36
  • 37. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Create new Laravel 5 app composer create-project laravel/laravel --prefer-dist 37
  • 38. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Create new Laravel 5 app composer global require “laravel/installer=~1.1” laravel new project-name 38
  • 39. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Migrate Configuration 1. Copy configuration from your 4.2 app’s env.php to .env 2. Compare configurations from your 4.2 app’s config/ 3. Recreate environment configurations from your 4.2 app’s config/env/ to.env 4. Update environment configurations to use env() 39
  • 40. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Migrate Configuration “Be sure to leave .env.example file in your project. It should contain placeholder values that will make it easy for other developers to copy and configure for their environment.” 40
  • 41. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Migrate Configuration “When managing multiple environments, you may find it easiest to create several .env files and symlink the .env within each environment.” 41
  • 42. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Move Files 42 4.2 5.0
  • 43. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Move Files • routes.php to app/Http/routes.php • app/views to resources/views • app/database to database/ 43
  • 44. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Add namespace “You do not need to do this.You can keep everything in the global namespace and add the paths to the classmap just as in Laravel 4.2. However, not doing so carries over technical debt as your project will not truly follow Laravel 5.0’s configuration.” 44
  • 45. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Add namespace <?php namespace AppHttpControllers;
 
 class YourController extends Controller { // ...
 }
 45
  • 46. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Add namespace <?php namespace App;
 
 class YourModel extends Eloquent { // ...
 }
 46
  • 47. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Review Bindings "Move any service container bindings from start/ global.php to the register method of the app/ Providers/AppServiceProvider.php file." 47
  • 48. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Miscellaneous Changes •SoftDeletingTrait is now SoftDeletes •User Authentication changes •Pagination method changes •Oh yeah, and the Form and Html Facades are gone. 48
  • 49. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Blade Changes 1. Cry 2. Bargain 3. Face reality 4. Start changing every {{ }} to {!! !!} 5. Remove all blade comment tags {{-- --}} (you should have known better) 6. Smile 49
  • 50. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Update your dependencies "Review your dependencies then run composer update" 50
  • 51. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Cross fingers 51
  • 52. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 201552
  • 53. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Questions… Ask now! Cause we’re moving to 5.1 53
  • 54. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 What’s New… In Laravel 5.1 54
  • 55. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Project Updates • Long Term Support • Requires PHP > 5.5.9 • Follows PSR-2 • Updated Documentation • Uses openssl for encryption, instead of mcrypt 55
  • 56. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 App Folder 56 5.0 5.1
  • 57. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Event Broadcasting "makes it easy to broadcast your events over a websocket connection." 57
  • 58. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Middleware Parameters <?php namespace AppHttpMiddleware; use Closure; class RoleMiddleware { public function handle($request, Closure $next, $role) { if (!$request->user()->hasRole($role)) { // Redirect... } return $next($request); } } 58
  • 59. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Middleware Parameters Route::put( ‘post/{id}', ['middleware' => 'role:editor', function ($id) { // ... }] ); 59
  • 60. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Focus on Testing • Stronger integration testing • Model factories 60
  • 61. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 What’s Coming… In Laravel 5.2 61
  • 62. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Laravel 5.2 • Coming December 2015 • Route filters have been deprecated in preference of middleware. • *_fetch methods deprecated in favor of *_pluck 62
  • 63. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Resources • What’s new in Laravel 5 Laracasts • Laravel Official Upgrade Guide • Laravel In-Place Upgrade Guide • What’s new in Laravel 5.1 Laracasts 63
  • 64. All Aboard for Laravel 5.1 - Jason McCreary - php[world] 2015 Questions… @gonedark on Twitter 64