The following are my notes from Drupal 8 meets Symfony2 on Wednesday, March 21st, 2012 at DrupalCon Denver. The slides can be found at http://speakerdeck.com/u/fabpot/p/symfony2-meets-drupal-8
Symfony is...
- A reusable set of standalone, decoupled, and cohesive PHP components that solve common web development problems
- Best practices
- Borrows ideas from other frameworks and languages
- Flexible and extenible
- an Object-Oriented set of classes
- compatible with PHP 5.3 and later
- a full-stack web framework
- Drupal is using some
- http://symfony.com
- https://github.com/symfony/symfony
- https://github.com/symfony/XXXX
- irc.freenode.net/symfony
Which Open-Source projects are already using the Symfony Components?
Projects
- Behat - a BDD framework
- Doctrine - an Object Relational Mapper and Database Abstraction Layer
- Propel - an object relational mapper
- PHPUnit - a PHP unit testing framework
- Jackalope - a content repository
Frameworks
Products
- easybook - a book publishing platform
- Midgard CMS - a content management framework
- Zikula - an application framework
- phpBB - a bulletin board software
What about Drupal 8?
- ClassLoader
- HttpFoundation
- HttpKernel
- Routing
- EventDispatcher
- DependencyInjection
Using the Symfony Components
- Acquiring:
- Git
- Archves
- PEAR
- Composer
- Symfony Components comes with Drupal 8
ClassLoader
- Loads classes on demand, only when needed
- Built to autload any PHP Class if it follows standard conventions
HttpFoundation
- Symfony leverages open standards, including HTTP (RFC 2616)
- http://symfony.com/doc/current/components/http_foundation.html
- Defines a feature-full object-oriented layer for the HTTP Messages
- Replaces PHP native global variables and functions to allow writing better, more secure, and more testible code
Routing
EventDispatcher
Similar to drupal hook system; biggest difference is that it’s OO.
HttpKernel
Implements dynamic part of HTTP specification.
HTTP Caching
- Symfony provides no caching layer for web pages; relies on HTTP cache headers
- Expiration
- Cache-Control
- Expires
- Validation
- Last-Modified
- If-Modified-Since
- Etag
- If-None-Match
- Expiration wins over Validation
- Cache the page for a short period of time, 10 seconds for example, and every 10 seconds the page is validated
- Using the default HttpKernel allows Drupal to Benefit