Your SlideShare is downloading. ×
Software Design Patterns in Laravel by Phill Sparks
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Software Design Patterns in Laravel by Phill Sparks

12,884
views

Published on

Laravel makes use of quite a few well-established design patterns that promote reusable object-oriented code. Together, we will investigate the design patterns used in the core of Laravel 4 and …

Laravel makes use of quite a few well-established design patterns that promote reusable object-oriented code. Together, we will investigate the design patterns used in the core of Laravel 4 and discuss how they encourage reusable software.

Published in: Technology, Design

4 Comments
41 Likes
Statistics
Notes
No Downloads
Views
Total Views
12,884
On Slideshare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
176
Comments
4
Likes
41
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Software Design Patterns in Laravel 4 by Phill Sparks
  • 2. Credits • Rosalind Goodall - Graphics • Taylor Otwell - Laravel
  • 3. @PhillSparks
  • 4. @PhillSparks •API Engineer at CrowdLab
  • 5. @PhillSparks •API Engineer at CrowdLab •From Leicester, UK
  • 6. @PhillSparks •API Engineer at CrowdLab •From Leicester, UK •Climbing Instructor
  • 7. @PhillSparks •API Engineer at CrowdLab •From Leicester, UK •Climbing Instructor •Scout
  • 8. @PhillSparks •API Engineer at CrowdLab •From Leicester, UK •Climbing Instructor •Scout •Laravel Core Team
  • 9. Laravel • With Laravel since 1.5.9 • Core Team Member • Past: Quality Team • Now: Community engagement and support
  • 10. Laravel • With Laravel since 1.5.9 • Core Team Member • Past: Quality Team • Now: Community engagement and support • Dayle still owes me 9000 support points!
  • 11. Software Design Patterns Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice. -- Christopher Alexander, AIS+77 “ ”
  • 12. Software Design Patterns
  • 13. Software Design Patterns
  • 14. The Patterns • Builder • Chain of Responsibility • Command • Facade • Factory • Iterator • Mediator • Observer • Presenter • Repository • Singleton • Strategy
  • 15. Notations
  • 16. Class Notations
  • 17. Sub-class Notations
  • 18. Abstract Class Notations
  • 19. Class Instance Notations
  • 20. Implementation Notations
  • 21. Building Blocks
  • 22. Interfaces namespace IlluminateAuth; interface UserInterface { public function getAuthIdentifier(); public function getAuthPassword(); } class GenericUser implements UserInterface {
  • 23. • 244 interfaces in Laravel (including vendors) • 25 from Laravel Core • 65 from Symfony • 73 from Swiftmailer Interface
  • 24. Abstract Classes namespace IlluminateDatabaseEloquentRelations; abstract class Relation { abstract public function addConstraints(); abstract public function getResults(); } class BelongsTo extends Relation {
  • 25. Abstract Classes • 128 abstract classes in Laravel (including vendors) • 14 from Laravel Core • 15 from Swiftmailer • 40 from Symfony
  • 26. Iterator
  • 27. PHP’s Iterator Interface
  • 28. Laravel’s Iterators • Collection • Paginator
  • 29. Observer
  • 30. Dispatcher namespace IlluminateEvents;
  • 31. Dispatcher namespace IlluminateEvents; class LoginHandler { function handle($user) { // do something with $data } } Event::listen(‘user.login’, ‘LoginHandler’); Event::fire(‘user.login’, $user);
  • 32. Singleton
  • 33. AliasLoader namespace IlluminateFoundation;
  • 34. Multiton
  • 35. DatabaseManager namespace IlluminateDatabase;
  • 36. Facade
  • 37. Facade namespace IlluminateSupportFacades;
  • 38. Input namespace IlluminateSupportFacades;
  • 39. Route namespace IlluminateSupportFacades;
  • 40. Response namespace IlluminateSupportFacades;
  • 41. Str namespace IlluminateSupport;
  • 42. Facade vs Singleton
  • 43. Decorator
  • 44. BootstrapPresenter namespace IlluminatePagination;
  • 45. BootstrapPresenter namespace IlluminatePagination;
  • 46. Repository • Examples: • IlluminateCacheRepository • IlluminateConfigRepository
  • 47. Builder (aka Manager) • Examples: • IlluminateAuthAuthManager • IlluminateCacheCacheManager • IlluminateQueueQueueManager • IlluminateSessionSessionManager
  • 48. Factory • Examples: • IlluminateDatabaseDatabaseManager • IlluminateDatabaseConnectors ConnectionFactory • IlluminateValidationFactory
  • 49. Service Provider • Core to Laravel’s IoC • See IlluminateSupportServiceProvider • Examples: • IlluminateAuthAuthServiceProvider • IlluminateHashHashServiceProvider • IlluminateLogLogServiceProvider
  • 50. Strategy • Examples: • IlluminateCacheStoreInterface • IlluminateConfigLoaderInterface • IlluminateDatabase - Builders & Grammars • IlluminateTranslationLoaderInterface • IlluminateViewViewFinderInterface
  • 51. s/PhillSparks//