drupal users group_symfony2
DESCRIPTION
TRANSCRIPT
![Page 1: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/1.jpg)
![Page 2: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/2.jpg)
Symfony2 Components in Drupal8
![Page 3: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/3.jpg)
Symfony2 Components in Drupal8
● PHP Programmer● LAMP● Symfony2 (is my favorite)
● Javascript● PHP Meetup Organizer
Twitter: @bzitzow
Email: [email protected]
![Page 4: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/4.jpg)
Symfony2 Components in Drupal8
How & Why?!
![Page 5: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/5.jpg)
Drupal & W.S.C.C.I.Web Services and Context Core Initiative
![Page 6: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/6.jpg)
Drupal & W.S.C.C.I.Web Services and Context Core Initiative
The Web Services and Context Core Initiative (WSCCI) aims to transform Drupal from a first-class CMS to a first-class REST server with a first-class CMS on top of it.
![Page 7: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/7.jpg)
Drupal & W.S.C.C.I.Web Services and Context Core Initiative
The Web Services and Context Core Initiative (WSCCI) aims to transform Drupal from a first-class CMS to a first-class REST server with a first-class CMS on top of it.
![Page 8: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/8.jpg)
First Class
![Page 9: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/9.jpg)
First Class
The term generally implies a high level of service, importance or quality.
Source: Wikipedia
![Page 10: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/10.jpg)
Quality
Code Testing Anyone?
![Page 11: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/11.jpg)
Drupal
A First Class CMS?
![Page 12: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/12.jpg)
Drupal
A First Class CMS?
![Page 13: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/13.jpg)
Drupal
A First Class REST Server?
![Page 14: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/14.jpg)
Drupal
A First Class REST Server?
![Page 15: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/15.jpg)
Drupal W.S.C.C.I.Web Services and Context Core Initiative
The Web Services and Context Core Initiative (WSCCI) aims to transform Drupal from a first-class CMS to a first-class REST server with a first-class CMS on top of it.
![Page 16: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/16.jpg)
Drupal W.S.C.C.I.Web Services and Context Core Initiative
The Web Services and Context Core Initiative (WSCCI) aims to transform Drupal from a first-class CMS to a first-class REST server with a first-class CMS on top of it.
To do that, we must give Drupal a unified, powerful context system that will support smarter, context- sensitive, easily cacheable block-centric layouts and non-page responses using a robust unified plugin mechanism.
Source: http://groups.drupal.org/wscci
![Page 17: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/17.jpg)
Enter Cliche` Wisdom
![Page 18: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/18.jpg)
Symfony2
![Page 19: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/19.jpg)
Symfony2
A reusable set of standalone, decoupled, and cohesive PHP components that solve common web development problems.
![Page 20: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/20.jpg)
Symfony2
A reusable set of standalone, decoupled, and cohesive PHP components that solve common web development problems.
“An HTTP framework; it is a Request / Response framework. That's the big deal. The fundamental principles of Symfony2 are centered around the HTTP specification.”
~ Fabien Potencier
![Page 21: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/21.jpg)
Symfony2 Components
● Http Kernel● Http Foundation● Event Dispatcher● Routing● Dependency Injection● Class Loader
![Page 22: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/22.jpg)
Symfony2 Components
● Http Kernel● Http Foundation● Event Dispatcher● Routing● Dependency Injection● Class Loader
![Page 23: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/23.jpg)
Symfony2 Components
● Http Kernel● Http Foundation● Event Dispatcher
![Page 24: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/24.jpg)
HTTP Kernel Component
The HttpKernel Component provides a structured process for converting a Request into a Response by making use of the event dispatcher.
![Page 25: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/25.jpg)
HTTP Kernel Component
![Page 26: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/26.jpg)
HTTP Kernel Component
The HttpKernel Component provides a structured process for converting a Request into a Response by making use of the event dispatcher.
Flexible enough to create: ● a full-stack framework (Symfony) ● a micro-framework (Silex) ● an advanced CMS system (Drupal)
![Page 27: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/27.jpg)
HTTP Kernel Component
The HttpKernel Component provides a structured process for converting a Request into a Response by making use of the event dispatcher.
Flexible enough to create: ● a full-stack framework (Symfony) ● a micro-framework (Silex) ● an advanced CMS system (Drupal)
![Page 28: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/28.jpg)
Symfony2 Components
● Http Kernel● Http Foundation● Event Dispatcher
![Page 29: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/29.jpg)
HTTP Foundation Component
The HttpFoundation Component defines an object-oriented layer for the HTTP
specification.
![Page 30: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/30.jpg)
HTTP Foundation Component
It is an Object-Oriented abstraction of some native PHP functions and variables:
![Page 31: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/31.jpg)
HTTP Foundation Component
It is an Object-Oriented abstraction of some native PHP functions and variables:
The Request class abstracts the main PHP global variables like:
● $_GET● $_POST● $_COOKIE● $_FILES● $_SERVER
![Page 32: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/32.jpg)
HTTP Foundation Component
It is an Object-Oriented abstraction of some native PHP functions and variables:
The Response class abstracts some PHP functions like
● Header()● Setcookie()● echo
![Page 33: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/33.jpg)
HTTP Foundation Component
It is an Object-Oriented abstraction of some native PHP functions and variables:
The Session class and SessionStorageInterface interface abstract session management session_*() functions.
![Page 34: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/34.jpg)
Symfony2 Components
● Http Kernel● Http Foundation● Event Dispatcher
![Page 35: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/35.jpg)
Event Dispatcher Component
![Page 36: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/36.jpg)
Event Dispatcher Component
● A listener (PHP object) tells a central dispatcher object that it wants to listen to an event;
![Page 37: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/37.jpg)
Event Dispatcher Component
● A listener (PHP object) tells a central dispatcher object that it wants to listen to an event;
● At some point, the dispatcher object is told to dispatch the event, passing with it an Event object;
![Page 38: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/38.jpg)
Event Dispatcher Component
● A listener (PHP object) tells a central dispatcher object that it wants to listen to an event;
● At some point, the dispatcher object is told to dispatch the event, passing with it an Event object;
● The dispatcher notifies (i.e. calls a method on) all listeners of the dispatched event, allowing each of them to make modifications to the Event object.
![Page 39: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/39.jpg)
Event Dispatcher Component
![Page 40: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/40.jpg)
Event Dispatcher Component
● Enable a system-wide plugin system● Drupal 8 will run hook system and Event
Dispatcher in parallel and power a lot of the core-level Drupal components.
● Drupal 9 – its up for discussion! “The D8 cycle will allow us to gain some experience with event subscribers, and compare them with hooks.”
● EventDispatcher more flexible (inheritance) & dependencies can be injected via the DIC.
http://drupal.org/node/1509164
![Page 41: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/41.jpg)
Routing Component
The Routing Component maps an HTTP request to a set of configuration variables.
![Page 42: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/42.jpg)
Routing Component
The Routing Component maps an HTTP request to a set of configuration variables.
● Define routes
![Page 43: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/43.jpg)
Routing Component
The Routing Component maps an HTTP request to a set of configuration variables.
● Define routes
● Gather information about the incoming request
![Page 44: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/44.jpg)
Routing Component
The Routing Component maps an HTTP request to a set of configuration variables.
● Define routes
● Gather information about the incoming request
● Match the incoming request route to the route definitions
![Page 45: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/45.jpg)
Routing Component
The Routing Component maps an HTTP request to a set of configuration variables.
● Define routes
– YAML
– XML
– PHP
![Page 46: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/46.jpg)
HTTP Kernel Component
![Page 47: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/47.jpg)
HTTP Kernel Component
kernel.request event
● Add more information to the Request, ● Initialize parts of the system
● Router listener ● Return a Response (denied!!!)
![Page 48: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/48.jpg)
HTTP Kernel Component
![Page 49: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/49.jpg)
HTTP Kernel Component
![Page 50: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/50.jpg)
HTTP Kernel Component
Resolve the controller based on routing info.
● ControllerResolver● getController()● getArguments()
![Page 51: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/51.jpg)
HTTP Kernel Component
![Page 52: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/52.jpg)
HTTP Kernel Component
kernel.controller event
● Initialize things for your app● Change the controller
![Page 53: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/53.jpg)
HTTP Kernel Component
![Page 54: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/54.jpg)
HTTP Kernel Component
HttpKernel::handle()
● Executes the controller● Passes it arguments● Controller builds response (resource)
![Page 55: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/55.jpg)
HTTP Kernel Component
![Page 56: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/56.jpg)
HTTP Kernel Component
![Page 57: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/57.jpg)
HTTP Kernel Component
![Page 58: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/58.jpg)
HTTP Kernel Component
kernel.view event
Transform a non-Response return value from a controller into a Response.
● Array to JSON● Array to HTML● Whatever you want to Whatever you want
![Page 59: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/59.jpg)
HTTP Kernel Component
![Page 60: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/60.jpg)
HTTP Kernel Component
kernel.response event
● Modify Response before it's sent● HTTP Headers● Add cookies● Change the response itself
![Page 61: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/61.jpg)
HTTP Kernel Component
![Page 62: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/62.jpg)
Symfony2 Components
![Page 63: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/63.jpg)
Symfony2 Components
TWIG Template Engine
![Page 64: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/64.jpg)
Symfony2 Components
Doctrine Annotations
![Page 65: Drupal users group_symfony2](https://reader034.vdocuments.us/reader034/viewer/2022051613/54c69b114a79593e578b4576/html5/thumbnails/65.jpg)
Symfony2 Components
Composer