SlideShare a Scribd company logo
Drupal users group_symfony2
Symfony2 Components in Drupal8
Symfony2 Components in Drupal8
● PHP Programmer
● LAMP
● Symfony2 (is my favorite)
● Javascript
● PHP Meetup Organizer
Twitter:
@bzitzow
Email:
bzitzow@gmail.com
Symfony2 Components in Drupal8
How & Why?!
Drupal & W.S.C.C.I.
Web Services and Context Core Initiative
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.
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.
First Class
First Class
The term generally implies a high level
of service, importance or quality.
Source: Wikipedia
Quality
Code Testing Anyone?
Drupal
A First Class CMS?
Drupal
A First Class CMS?
Drupal
A First Class REST Server?
Drupal
A First Class REST Server?
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.
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
Enter Cliche` Wisdom
Symfony2
Symfony2
A reusable set of standalone, decoupled, and
cohesive PHP components that solve common
web development problems.
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
Symfony2 Components
● Http Kernel
● Http Foundation
● Event Dispatcher
● Routing
● Dependency Injection
● Class Loader
Symfony2 Components
● Http Kernel
● Http Foundation
● Event Dispatcher
● Routing
● Dependency Injection
● Class Loader
Symfony2 Components
● Http Kernel
● Http Foundation
● Event Dispatcher
HTTP Kernel Component
The HttpKernel Component provides a
structured process for converting a Request
into a Response by making use of the event
dispatcher.
HTTP Kernel Component
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)
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)
Symfony2 Components
● Http Kernel
● Http Foundation
● Event Dispatcher
HTTP Foundation Component
The HttpFoundation Component defines an
object-oriented layer for the HTTP
specification.
HTTP Foundation Component
It is an Object-Oriented abstraction of some
native PHP functions and variables:
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
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
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.
Symfony2 Components
● Http Kernel
● Http Foundation
● Event Dispatcher
Event Dispatcher Component
Event Dispatcher Component
● A listener (PHP object) tells a central dispatcher
object that it wants to listen to an event;
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;
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.
Event Dispatcher Component
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
Routing Component
The Routing Component maps an HTTP request
to a set of configuration variables.
Routing Component
The Routing Component maps an HTTP request
to a set of configuration variables.
● Define routes
Routing Component
The Routing Component maps an HTTP request
to a set of configuration variables.
● Define routes
● Gather information about the incoming request
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
Routing Component
The Routing Component maps an HTTP request
to a set of configuration variables.
● Define routes
– YAML
– XML
– PHP
HTTP Kernel Component
HTTP Kernel Component
kernel.request event
● Add more information to the Request,
● Initialize parts of the system
● Router listener
● Return a Response (denied!!!)
HTTP Kernel Component
HTTP Kernel Component
HTTP Kernel Component
Resolve the controller based on routing info.
● ControllerResolver
● getController()
● getArguments()
HTTP Kernel Component
HTTP Kernel Component
kernel.controller event
● Initialize things for your app
● Change the controller
HTTP Kernel Component
HTTP Kernel Component
HttpKernel::handle()
● Executes the controller
● Passes it arguments
● Controller builds response (resource)
HTTP Kernel Component
HTTP Kernel Component
HTTP Kernel Component
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
HTTP Kernel Component
HTTP Kernel Component
kernel.response event
● Modify Response before it's sent
● HTTP Headers
● Add cookies
● Change the response itself
HTTP Kernel Component
Symfony2 Components
Symfony2 Components
TWIG Template Engine
Symfony2 Components
Doctrine Annotations
Symfony2 Components
Composer

More Related Content

PPTX
Bootify your spring application
ODP
Docker for Developers - PHP Detroit 2018
PDF
Gradle起步走: 以CLI Application為例 @ JCConf 2014
PDF
Situated Program Challenge with Haskell & Clojure
PDF
Using PHP Functions! (Not those functions, Google Cloud Functions)
ODP
Http programming in play
PPT
CGI Presentation
PDF
What's New In Laravel 5
Bootify your spring application
Docker for Developers - PHP Detroit 2018
Gradle起步走: 以CLI Application為例 @ JCConf 2014
Situated Program Challenge with Haskell & Clojure
Using PHP Functions! (Not those functions, Google Cloud Functions)
Http programming in play
CGI Presentation
What's New In Laravel 5

What's hot (20)

PDF
Killer Docker Workflows for Development
PDF
PyCon Korea - Real World Graphene
PDF
Ancient To Modern: Upgrading nearly a decade of Plone in public radio
PPTX
Java 8 concurrency abstractions
PPTX
Laravel for Web Artisans
PPT
CGI Introduction
ODP
REST API Laravel
PDF
Mojolicious and REST
PDF
Why Laravel?
PDF
Akka http 2
PPT
JavaOne 2009 - TS-5276 - RESTful Protocol Buffers
PDF
2021.laravelconf.tw.slides1
PDF
Expressive Microservice Framework Blastoff
PPT
Common gateway interface
PDF
Laravel.IO A Use-Case Architecture
PDF
From CakePHP to Laravel
PDF
Laravel 5 Annotations: RESTful API routing
PDF
java8-patterns
ODP
Lisp Meet Up #31, Clake: a GNU make-like build utility in Common Lisp
Killer Docker Workflows for Development
PyCon Korea - Real World Graphene
Ancient To Modern: Upgrading nearly a decade of Plone in public radio
Java 8 concurrency abstractions
Laravel for Web Artisans
CGI Introduction
REST API Laravel
Mojolicious and REST
Why Laravel?
Akka http 2
JavaOne 2009 - TS-5276 - RESTful Protocol Buffers
2021.laravelconf.tw.slides1
Expressive Microservice Framework Blastoff
Common gateway interface
Laravel.IO A Use-Case Architecture
From CakePHP to Laravel
Laravel 5 Annotations: RESTful API routing
java8-patterns
Lisp Meet Up #31, Clake: a GNU make-like build utility in Common Lisp
Ad

Similar to Drupal users group_symfony2 (20)

PPT
PHP Frameworks and CodeIgniter
PPTX
Creating your own framework on top of Symfony2 Components
PDF
Symfony2 - Request to Response
PDF
Kurento cpmx
PPTX
How to Create a Service in Choreo
PDF
Netflix conductor
PPT
Introduction to web and php mysql
ZIP
Mojolicious
PDF
Plugin development demystified 2017
PDF
25 Intro to Symfony #burningkeyboards
PPTX
Building and managing applications fast for IBM i
PDF
Android Performance #4: Network
PDF
BinProxy: New Paradigm of Binary Analysis With Your Favorite Web Proxy
PPTX
SERVLETS (2).pptxintroduction to servlet with all servlets
PDF
Symfony 2.0 on PHP 5.3
PDF
PHP QA Tools
PDF
web2py:Web development like a boss
PDF
WinAppDriver Development
PHP Frameworks and CodeIgniter
Creating your own framework on top of Symfony2 Components
Symfony2 - Request to Response
Kurento cpmx
How to Create a Service in Choreo
Netflix conductor
Introduction to web and php mysql
Mojolicious
Plugin development demystified 2017
25 Intro to Symfony #burningkeyboards
Building and managing applications fast for IBM i
Android Performance #4: Network
BinProxy: New Paradigm of Binary Analysis With Your Favorite Web Proxy
SERVLETS (2).pptxintroduction to servlet with all servlets
Symfony 2.0 on PHP 5.3
PHP QA Tools
web2py:Web development like a boss
WinAppDriver Development
Ad

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Encapsulation theory and applications.pdf
PPTX
Cloud computing and distributed systems.
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Big Data Technologies - Introduction.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Machine learning based COVID-19 study performance prediction
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The AUB Centre for AI in Media Proposal.docx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Unlocking AI with Model Context Protocol (MCP)
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Encapsulation theory and applications.pdf
Cloud computing and distributed systems.
Building Integrated photovoltaic BIPV_UPV.pdf
cuic standard and advanced reporting.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Chapter 3 Spatial Domain Image Processing.pdf
Assigned Numbers - 2025 - Bluetooth® Document
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Big Data Technologies - Introduction.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Spectral efficient network and resource selection model in 5G networks
Machine learning based COVID-19 study performance prediction
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

Drupal users group_symfony2