Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Laravel 5
Brian Feaver
Lead Developer @ WiseBanyan
About Me
• Lead Developer at WiseBanyan
• Free online financial advisor
• http://wisebanyan.com
• 10+ years of software de...
Assumptions
You know these right?
• Composer
• Basic development environment
• Can read documentation
• http://laravel.com...
What am I covering?
• What is Laravel?
• Basics of Laravel (basics of any framework
ever?)
• Some cool stuff about Laravel...
What is Laravel?
• PHP Framework for Web Artisans
• Built on top of Symfony2 Components
• Like any framework, provides ser...
The Basics
• Routing
• Controllers
• Templating (Blade)
• ORM (Eloquent)
Routing
• Routes are defined in routes.php
• Basic route uses a closure
• Or you can use a Controller
http://laravel.com/d...
Routing w/ Closure
Routing with a Controller
Routing with a Controller
Route Parameters
You can define parameters within the route
Templates
Laravel uses the Blade template engine
Layouts
http://laravel.com/docs/5.0/templates
Templates
Using the layout
Eloquent (ORM)
http://laravel.com/docs/5.0/eloquent
Eloquent (ORM)
• Active Record
• Table - plural, snake_case class name
• Migrations
• Support relationships
• Soft deletin...
Eloquent (ORM)
The Bad™
• “Joins”
• Uses subqueries
• You can do actual joins, but you have to write them using
the query ...
The Cool Stuff
• Artisan
• Dependency Injection (Container)
• Queue
• Middleware
• Filesystem (Storage Facade)
• Encryptio...
The Cool Stuff
That really shouldn’t be so cool…
The Cool Stuff
That really shouldn’t be so cool…
Facades
Facades
What do they look like?
Facade::doSomethingCool()
Facades
What do they look like?
Facade::doSomethingCool()
Isn’t that a static method?
Well, no…
Facades
What are they?
• A “static” access to underlying service
• Look like static resources, but actually uses
services ...
Facades
Why you shouldn’t use them…
• They hide the dependencies of the service or
class using them - This is the importan...
Facades
What to do instead
You can instead inject them by their
underlying service class names.
See:
http://laravel.com/do...
Facade Injection
Onto the cool stuff…
Artisan
http://laravel.com/docs/5.0/artisan
Dependency Injection
(Container)
• App::make() - Facade…
• Uses reflection to determine dependencies
• Does not require an...
Queue
• Interface to:
• Amazon SQS
• IronMQ
• Redis queues
• Beanstalkd
• sync - calls job inline
http://laravel.com/docs/...
Queue (worker)
• Use artisan to consume the job in the queue
• php artisan queue:work
• Also provides queue:listen and --d...
Middleware
• Allows processing or filtering of requests entering
the system
• http://laravel.com/docs/5.0/middleware
Encry...
Filesystem
• Abstraction layer to local and remote filesystems
• Amazon S3
• FTP/SFTP
• Local
• Dropbox
• Uses the league/...
Authentication
• Includes libraries to do basic username/password
authentication out of the box
• Includes password recove...
Lots of additional
functionality…
http://laravel.com/docs/5.0
Questions?
Upcoming SlideShare
Loading in …5
×

Laravel 5

5,941 views

Published on

Brief introduction to Laravel 5. Given at LV PHP User Group - 2015/06/04

Published in: Internet
  • Nice Tutorials, Refer these to start developing application from scratch in Laravel 5.1 http://infidigisolutions.com/larb/index1.html,http://infidigisolutions.com/larb/index2.html, http://infidigisolutions.com/larb/index3.html
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Njce! Thanks for sharing.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Laravel 5

  1. 1. Laravel 5 Brian Feaver Lead Developer @ WiseBanyan
  2. 2. About Me • Lead Developer at WiseBanyan • Free online financial advisor • http://wisebanyan.com • 10+ years of software development
  3. 3. Assumptions You know these right? • Composer • Basic development environment • Can read documentation • http://laravel.com/docs/5.0#install-laravel
  4. 4. What am I covering? • What is Laravel? • Basics of Laravel (basics of any framework ever?) • Some cool stuff about Laravel (packaged libraries and services) • Some things not-so-cool
  5. 5. What is Laravel? • PHP Framework for Web Artisans • Built on top of Symfony2 Components • Like any framework, provides services and libraries to make interacting with web requests and other services
  6. 6. The Basics • Routing • Controllers • Templating (Blade) • ORM (Eloquent)
  7. 7. Routing • Routes are defined in routes.php • Basic route uses a closure • Or you can use a Controller http://laravel.com/docs/5.0/routing
  8. 8. Routing w/ Closure
  9. 9. Routing with a Controller
  10. 10. Routing with a Controller
  11. 11. Route Parameters You can define parameters within the route
  12. 12. Templates Laravel uses the Blade template engine Layouts http://laravel.com/docs/5.0/templates
  13. 13. Templates Using the layout
  14. 14. Eloquent (ORM) http://laravel.com/docs/5.0/eloquent
  15. 15. Eloquent (ORM) • Active Record • Table - plural, snake_case class name • Migrations • Support relationships • Soft deleting • Timestamps
  16. 16. Eloquent (ORM) The Bad™ • “Joins” • Uses subqueries • You can do actual joins, but you have to write them using the query builder yourself • Can cause missing information with duplicate columns • Eager loading - Model::with(‘relation’) • Runs two queries • My usual Active Record gripes…
  17. 17. The Cool Stuff • Artisan • Dependency Injection (Container) • Queue • Middleware • Filesystem (Storage Facade) • Encryption • Authentication
  18. 18. The Cool Stuff That really shouldn’t be so cool…
  19. 19. The Cool Stuff That really shouldn’t be so cool… Facades
  20. 20. Facades What do they look like? Facade::doSomethingCool()
  21. 21. Facades What do they look like? Facade::doSomethingCool() Isn’t that a static method? Well, no…
  22. 22. Facades What are they? • A “static” access to underlying service • Look like static resources, but actually uses services underneath • Can be mocked for testing (at least with Mockery… no comment)
  23. 23. Facades Why you shouldn’t use them… • They hide the dependencies of the service or class using them - This is the important one! • Can be overridden, but then you override them everywhere http://programmingarehard.com/2014/01/11/stop-using-facades.html
  24. 24. Facades What to do instead You can instead inject them by their underlying service class names. See: http://laravel.com/docs/5.0/facades#facade-class-reference
  25. 25. Facade Injection
  26. 26. Onto the cool stuff…
  27. 27. Artisan http://laravel.com/docs/5.0/artisan
  28. 28. Dependency Injection (Container) • App::make() - Facade… • Uses reflection to determine dependencies • Does not require any configuration • Can be configured with a ServiceProvider (PHP class)
  29. 29. Queue • Interface to: • Amazon SQS • IronMQ • Redis queues • Beanstalkd • sync - calls job inline http://laravel.com/docs/5.0/queues
  30. 30. Queue (worker) • Use artisan to consume the job in the queue • php artisan queue:work • Also provides queue:listen and --daemon for continuous workers
  31. 31. Middleware • Allows processing or filtering of requests entering the system • http://laravel.com/docs/5.0/middleware Encryption • Simplified encryption using mcrypt • http://laravel.com/docs/5.0/encryption
  32. 32. Filesystem • Abstraction layer to local and remote filesystems • Amazon S3 • FTP/SFTP • Local • Dropbox • Uses the league/flysystem library http://laravel.com/docs/5.0/filesystem
  33. 33. Authentication • Includes libraries to do basic username/password authentication out of the box • Includes password recovery (Forgot password?) • Protecting routes using filters http://laravel.com/docs/5.0/authentication
  34. 34. Lots of additional functionality… http://laravel.com/docs/5.0
  35. 35. Questions?

×