Starting with Symfony2

download Starting with Symfony2

of 37

  • date post

    27-Jan-2015
  • Category

    Technology

  • view

    103
  • download

    0

Embed Size (px)

description

 

Transcript of Starting with Symfony2

  • 1. Starting with

2. About Me Kevin Bond Kitchener, Ontario PHP Developer Symfony2 core/docs contributorkevinbond@gmail.comzenstruck.com@zenstruck 3. What is Symfony2?@zenstruck 4. What is Symfony2? Set of stand-alone, decoupled components @zenstruck 5. What is Symfony2? Set of stand-alone, decoupled components Full-stack framework based on thesecomponents @zenstruck 6. What is Symfony2? Set of stand-alone, decoupled components Full-stack framework based on thesecomponents Community Forum/Mailing List/IRC (#symfony on Freenode) 3rd party bundles (knpbundles.com) 5000+ watchers / 1300+ forks 560+ unique contributors@zenstruck 7. Symfony2 ComponentsDependencyInjectionEventDispatcherHttpFoundation DomCrawler ClassLoaderCssSelectorHttpKernelBrowserKitTemplatingTranslation Serializer Validator Security Routing Console ProcessConfigFinderLocale Yaml Form@zenstruck 8. Projects using Symfony2 Assetic (Process) Doctrine2 (Console) PHPUnit (Yaml) Behat Silex Drupal 8 Propel@zenstruck 9. Why use Symfony2? Fast PHP 5.3 Well engineered (no singletons) Forces* best practices Extensible and flexible Stable and established Testable@zenstruck 10. What Symfony2 is not @zenstruck 11. What Symfony2 is not MVC Framework @zenstruck 12. What Symfony2 is not MVC Framework @zenstruck 13. HTTP Framework Request Response@zenstruck 14. HTTP FrameworkRequest ResponseI dont like MVC because thats not how the web works. Symfony2is an HTTP framework; it is a Request/Response framework.Thats the big deal. The fundamental principles of Symfony2 arecentered around the HTTP specification. - Fabien Potencier@zenstruck 15. Bundles Everything is a bundle (even the framework is a collection of corebundles) Bundles contain: Configuration/Translations/Documentation Routes/Controllers/Views Public resources (js/css/images) Services/Events/Models/Forms etc (* dont make your bundle a library) Tests NOT VENDOR LIBS Override with child bundle 690+ bundles on knpbundles.com@zenstruck 16. Useful Bundles FOSUserBundle FOSFacebookBundle KnpMenuBundle SonataAdminBundle FOSJsRoutingBundle OAuthBundle JMSI18nRoutingBundle @zenstruck 17. Anatomy of a Request @zenstruck 18. Anatomy of a Request Request @zenstruck 19. Anatomy of a Request Request Kernel @zenstruck 20. Anatomy of a Request Request Kernel Controller @zenstruck 21. Anatomy of a Request Request Kernel Controller Response (html, json, xml, etc...) @zenstruck 22. Anatomy of a Request Request Kernel Controller Exception? Response (html, json, xml, etc...) @zenstruck 23. Service Container 24. Get Startedcurl -s http://getcomposer.org/installer | phpcomposer.phar create-project symfony/framework-standard-edition path/to/install@zenstruck 25. Demo 26. Killer Feature @zenstruck 27. Killer Feature Symfony2 Reverse Proxy@zenstruck 28. 3 Types of HTTP Cache From the docs: Browser caches: Every browser comes with its own local cache thatis mainly useful for when you hit "back" or for images and otherassets. The browser cache is a private cache as cached resourcesarent shared with anyone else. Proxy caches: A proxy is a shared cache as many people can bebehind a single one. Its usually installed by large corporations andISPs to reduce latency and network traffic. Gateway caches: Like a proxy, its also a shared cache but on theserver side. Installed by network administrators, it makes websitesmore scalable, reliable and performant. @zenstruck 29. Symfony2 Reverse Proxy Request Kernel Controller Response (html, json, xml, etc...) @zenstruck 30. Symfony2 Reverse Proxy Request Reverse Proxy Kernel Controller Response (html, json, xml, etc...) @zenstruck 31. Symfony2 Reverse Proxy Request Reverse Proxy Kernel Controller Response (html, json, xml, etc...) Set s-maxage header @zenstruck 32. Symfony2 Reverse Proxy Request Reverse Proxy Cached version? Kernel Controller Response (html, json, xml, etc...) Set s-maxage header @zenstruck 33. Caching Dynamic Content@zenstruck 34. Caching Dynamic Content Sub-requests@zenstruck 35. Caching Dynamic Content Sub-requests ESI Edge Side Includes Server side sub-requests @zenstruck 36. Caching Dynamic Content Sub-requests ESI Edge Side Includes Server side sub-requests CSI Client Side Includes (new in 2.1) Uses javascript (hinclude.js) Client side sub-requests@zenstruck 37. Resources github.com/kbond/gpug-symfony2 symfony.com (docs/cookbook) fabien.potencier.org knpbundles.com richardmiller.co.uk knpuniversity.com connect.sensiolabs.com live.symfony.com mnot.github.com/hinclude @zenstruck