SlideShare a Scribd company logo
Introduction to Symfony components
and helper components in Drupal 8
Ankit Babbar
Drupal Developer at Valuebound
Volunteer at SPIC MACAY
twitter: ankitbabbar
Introduction to Symfony Components and helper components in Drupal 8
History of PHP
Functional vs OOPs Programming
Frameworks
3rd Party Libraries
Namespace
PHP-FIG
YAML
Composer
Awesome Drupal CMS +
Symfony2 Framework
+ Best PHP Practices from Community
Introduction to Symfony Components and helper components in Drupal 8
https://cipix.nl/understanding-drupal-8-part-1-general-structure-framework
HTTP Foundation
Introduction to Symfony Components and helper components in Drupal 8
Request -> Response
HTTP request looks like:
GET /foo.html HTTP/1.1
Host: example.com
Accept: text/html
User-Agent: Mozialla/5.0 (Macintosh)
GET
Retrieve the resource from the
server
POST
Create a resource on the
server
PUT
Update the resource on the
server
DELETE
Delete the resource from the
server
Request
Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8
HTTP response looks like:
HTTP/1.1 200 OK
Date: Sat, 25 Jul 2015 10:30:00 IST
Server: apache2/2.xx
Content-Type: text/html
<html>
Response
Routing
YAML: YAML Ain’t Markup Language
Sample Router
hello_world.content:
path: ‘/hello-world'
defaults:
_controller: 'DrupalhelloControllerHelloController::content'
_title: 'Hello World'
requirements:
_permission: 'access content'
Controllers
Sample Hello World Controller
class HelloController extends ControllerBase {
public function content() {
return array(
'#type' => 'markup',
'#markup' => t('Hello, World!'),
);
}
}
Application Flow
Event Dispatcher
Introduction to Symfony Components and helper components in Drupal 8
HTTP Kernel
Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8
Dependency Injection
class Notifier {
private $mailer;
public function __construct() {
$this->mailer = new Mailer();
}
public function notify() {
…
$this->mailer->send($from, $to, $msg);
…
}
}
class Notifier {
private $mailer;
public function __construct(MailInterface $m) {
$this->mailer = $m;
}
public function notify() {
….
$this->mailer->send($from, $to, $msg);
…
}
}
$mailer = new SpecialMailer();
$notifier = new Notifier($mailer);
Composer
Sample composer.json for hello_world module
{
"name": “drupal/hello_world",
"require": {
"mailchimp/mailchimp": "2.0.6"
}
}
Namespace
+
Autoloading
Full Controller File Look like:
<?php
/**
* @file
* Contains DrupalhelloControllerHelloController.
*/
namespace DrupalhelloController;
use DrupalCoreControllerControllerBase;
class HelloController extends ControllerBase {
public function content() {
return array(
'#type' => 'markup',
'#markup' => t('Hello, World!'),
);
}
}
?>
Serializer
Array
Serialization
FormatObject
DeSerialization
Validator
Introduction to Symfony Components and helper components in Drupal 8
1. Symfony Documentation
2. DrupalCon Denver 2012: DRUPAL 8 MEETS SYMFONY2
https://www.youtube.com/watch?v=Gr71z_WoejM
3. UNDERSTANDING DRUPAL 8: https://cipix.nl/understanding-drupal-8-part-1-general-
structure-framework
4. DrupalCon Portland 2013: DEPENDENCY INJECTION IN DRUPAL 8
https://www.youtube.com/watch?v=kocJ6pn9kEc
5. DrupalCon Denver 2012: DRUPAL 8 MEETS SYMFONY2
https://www.youtube.com/watch?v=Gr71z_WoejM
6. Symfony en Drupal 8
http://symfony.com/doc/current/components/event_dispatcher/introduction.html#introduction
7. Unravelling the Drupal 8 Plugin System https://drupalize.me/blog/201409/unravelling-drupal-
8-plugin-system
8. Drupal 8 Plugin System https://www.youtube.com/watch?v=2o5uY-iOoMo
9. PSR-4 http://www.php-fig.org/psr/psr-4/
10. Namespaces http://php.net/manual/en/language.namespaces.php
References and Resources
Thank You!
Questions?

More Related Content

PPTX
Php psr standard 2014 01-22
PDF
Talking to Web Services
PPTX
Phalcon 2 - PHP Brazil Conference
PPT
Heavy Web Optimization: Backend
PDF
WP HTTP API
PDF
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
PPTX
PHP Conference - Phalcon hands-on
KEY
LvivPy - Flask in details
Php psr standard 2014 01-22
Talking to Web Services
Phalcon 2 - PHP Brazil Conference
Heavy Web Optimization: Backend
WP HTTP API
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
PHP Conference - Phalcon hands-on
LvivPy - Flask in details

What's hot (20)

PPT
Learn flask in 90mins
PPT
Build your own PHP extension
PDF
CakePHP 3.0: Embracing the future
ODP
Website releases made easy with the PEAR installer, OSCON 2009
PDF
Quick flask an intro to flask
PPTX
EdTechJoker Spring 2020 - Lecture 8 Drupal again
PDF
Web develop in flask
PPTX
Flask – Python
ODP
REST API Laravel
PPT
Learn REST API with Python
PPTX
PHP Function
PDF
Dependency management with Composer
PDF
Flask patterns
KEY
Php Power Tools
ODP
Website releases made easy with the PEAR installer - Barcelona 2008
PPT
Rapid java backend and api development for mobile devices
PDF
CakePHP 3
ODP
Buildout: How to maintain big app stacks without losing your mind
PPS
PHP - History, Introduction, Summary, Extensions and Frameworks
PPTX
Python at Facebook
Learn flask in 90mins
Build your own PHP extension
CakePHP 3.0: Embracing the future
Website releases made easy with the PEAR installer, OSCON 2009
Quick flask an intro to flask
EdTechJoker Spring 2020 - Lecture 8 Drupal again
Web develop in flask
Flask – Python
REST API Laravel
Learn REST API with Python
PHP Function
Dependency management with Composer
Flask patterns
Php Power Tools
Website releases made easy with the PEAR installer - Barcelona 2008
Rapid java backend and api development for mobile devices
CakePHP 3
Buildout: How to maintain big app stacks without losing your mind
PHP - History, Introduction, Summary, Extensions and Frameworks
Python at Facebook
Ad

Viewers also liked (14)

PPTX
Vocal Health
DOCX
Effective Communication Skills
PDF
Industrial Refrigeration - dual flow Unit Cooler
PDF
Dry Coolers - liquid coolers by Thermokey
DOCX
Kerucut
PDF
Heat Exchanger Solutions - Thermokey Company Profile
PPTX
Les tic (technologies de l'information et de
PDF
Microchannel Remote Condenser
PPTX
есен
PPTX
PPTX
Introduction to Symfony Components and helper components in Drupal 8
PPTX
Dental implants and biomaterials
DOCX
RPP Program Linier (Persentasi ICT)
PPTX
TISSUE DEVELOPMENT WITH TISSUE ENGINEERING APPROACH
Vocal Health
Effective Communication Skills
Industrial Refrigeration - dual flow Unit Cooler
Dry Coolers - liquid coolers by Thermokey
Kerucut
Heat Exchanger Solutions - Thermokey Company Profile
Les tic (technologies de l'information et de
Microchannel Remote Condenser
есен
Introduction to Symfony Components and helper components in Drupal 8
Dental implants and biomaterials
RPP Program Linier (Persentasi ICT)
TISSUE DEVELOPMENT WITH TISSUE ENGINEERING APPROACH
Ad

Similar to Introduction to Symfony Components and helper components in Drupal 8 (20)

PDF
Drupal users group_symfony2
PDF
Master the New Core of Drupal 8 Now: with Symfony and Silex
PDF
Drupal8 for Symfony developers - Dutch PHP
PPTX
Creating your own framework on top of Symfony2 Components
PDF
Drupal8 for Symfony Developers (PHP Day Verona 2017)
PDF
Symfony book 2.1
PPTX
Ran Mizrahi - Symfony2 meets Drupal8
PPT
симфони это не страшно
PDF
Drupal symfony
PPT
Into to drupal8
PDF
Learn Drupal 8 Render Pipeline
PPTX
Drupal 8, Symfony and Content Management
PDF
Drupal8 for Symfony Developers
PDF
Symfony and Drupal 8
KEY
Symfony2 - A Short Introduction
PDF
Symfony quick tour_2.3
PDF
Symfony Components 2.0 on PHP 5.3
PDF
Using HttpKernelInterface for Painless Integration
PPTX
PDF
Symfony 2 (PHP Quebec 2009)
Drupal users group_symfony2
Master the New Core of Drupal 8 Now: with Symfony and Silex
Drupal8 for Symfony developers - Dutch PHP
Creating your own framework on top of Symfony2 Components
Drupal8 for Symfony Developers (PHP Day Verona 2017)
Symfony book 2.1
Ran Mizrahi - Symfony2 meets Drupal8
симфони это не страшно
Drupal symfony
Into to drupal8
Learn Drupal 8 Render Pipeline
Drupal 8, Symfony and Content Management
Drupal8 for Symfony Developers
Symfony and Drupal 8
Symfony2 - A Short Introduction
Symfony quick tour_2.3
Symfony Components 2.0 on PHP 5.3
Using HttpKernelInterface for Painless Integration
Symfony 2 (PHP Quebec 2009)

Recently uploaded (20)

PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Cloud computing and distributed systems.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Sensors and Actuators in IoT Systems using pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Advanced IT Governance
PDF
Spectral efficient network and resource selection model in 5G networks
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Modernizing your data center with Dell and AMD
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Cloud computing and distributed systems.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Chapter 3 Spatial Domain Image Processing.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
MYSQL Presentation for SQL database connectivity
Sensors and Actuators in IoT Systems using pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
madgavkar20181017ppt McKinsey Presentation.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
The Rise and Fall of 3GPP – Time for a Sabbatical?
Network Security Unit 5.pdf for BCA BBA.
Advanced IT Governance
Spectral efficient network and resource selection model in 5G networks
“AI and Expert System Decision Support & Business Intelligence Systems”
20250228 LYD VKU AI Blended-Learning.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
GamePlan Trading System Review: Professional Trader's Honest Take
Review of recent advances in non-invasive hemoglobin estimation
Modernizing your data center with Dell and AMD

Introduction to Symfony Components and helper components in Drupal 8

  • 1. Introduction to Symfony components and helper components in Drupal 8 Ankit Babbar Drupal Developer at Valuebound Volunteer at SPIC MACAY twitter: ankitbabbar
  • 3. History of PHP Functional vs OOPs Programming Frameworks 3rd Party Libraries Namespace PHP-FIG YAML Composer
  • 4. Awesome Drupal CMS + Symfony2 Framework + Best PHP Practices from Community
  • 10. HTTP request looks like: GET /foo.html HTTP/1.1 Host: example.com Accept: text/html User-Agent: Mozialla/5.0 (Macintosh) GET Retrieve the resource from the server POST Create a resource on the server PUT Update the resource on the server DELETE Delete the resource from the server Request
  • 15. HTTP response looks like: HTTP/1.1 200 OK Date: Sat, 25 Jul 2015 10:30:00 IST Server: apache2/2.xx Content-Type: text/html <html> Response
  • 17. YAML: YAML Ain’t Markup Language Sample Router hello_world.content: path: ‘/hello-world' defaults: _controller: 'DrupalhelloControllerHelloController::content' _title: 'Hello World' requirements: _permission: 'access content'
  • 19. Sample Hello World Controller class HelloController extends ControllerBase { public function content() { return array( '#type' => 'markup', '#markup' => t('Hello, World!'), ); } }
  • 36. class Notifier { private $mailer; public function __construct() { $this->mailer = new Mailer(); } public function notify() { … $this->mailer->send($from, $to, $msg); … } }
  • 37. class Notifier { private $mailer; public function __construct(MailInterface $m) { $this->mailer = $m; } public function notify() { …. $this->mailer->send($from, $to, $msg); … } } $mailer = new SpecialMailer(); $notifier = new Notifier($mailer);
  • 38. Composer Sample composer.json for hello_world module { "name": “drupal/hello_world", "require": { "mailchimp/mailchimp": "2.0.6" } }
  • 40. Full Controller File Look like: <?php /** * @file * Contains DrupalhelloControllerHelloController. */ namespace DrupalhelloController; use DrupalCoreControllerControllerBase; class HelloController extends ControllerBase { public function content() { return array( '#type' => 'markup', '#markup' => t('Hello, World!'), ); } } ?>
  • 44. 1. Symfony Documentation 2. DrupalCon Denver 2012: DRUPAL 8 MEETS SYMFONY2 https://www.youtube.com/watch?v=Gr71z_WoejM 3. UNDERSTANDING DRUPAL 8: https://cipix.nl/understanding-drupal-8-part-1-general- structure-framework 4. DrupalCon Portland 2013: DEPENDENCY INJECTION IN DRUPAL 8 https://www.youtube.com/watch?v=kocJ6pn9kEc 5. DrupalCon Denver 2012: DRUPAL 8 MEETS SYMFONY2 https://www.youtube.com/watch?v=Gr71z_WoejM 6. Symfony en Drupal 8 http://symfony.com/doc/current/components/event_dispatcher/introduction.html#introduction 7. Unravelling the Drupal 8 Plugin System https://drupalize.me/blog/201409/unravelling-drupal- 8-plugin-system 8. Drupal 8 Plugin System https://www.youtube.com/watch?v=2o5uY-iOoMo 9. PSR-4 http://www.php-fig.org/psr/psr-4/ 10. Namespaces http://php.net/manual/en/language.namespaces.php References and Resources