More Related Content Similar to MidwestPHP Symfony2 Internals Similar to MidwestPHP Symfony2 Internals (20) More from Raul Fraile (17) MidwestPHP Symfony2 Internals3. Raúl Fraile
• Software developer at
• I live in Spain
• PHP 5.3 Zend Certified Engineer
• Symfony Certified Developer
• Symfony2 lover ❤
• LadybugPHP: Simple and extensible PHP dumper
• Future dad ☺
@raulfraile
10. 1. Symfony2 components
2. Composer
3. Autoloading & PSR-0
4. Request & Response
5. Demo 1
6. Symfony2 full-stack framework
7. Events
8. Demo 2
15. BrowserKit Finder Security
ClassLoader Form Serializer
Config HttpFoundation Templating
Console HttpKernel Translation
CssSelector Locale Validator
DependencyInjection Process Yaml
DomCrawler OptionsResolver
EventDispatcher Routing
16. BrowserKit Finder Security
ClassLoader Form Serializer
Config HttpFoundation Templating
Console HttpKernel Translation
CssSelector Locale Validator
DependencyInjection Process Yaml
DomCrawler OptionsResolver PropertyAccess
2.2.0
EventDispatcher Routing StopWatch
23. {
"require": {
"symfony/http-foundation": "v2.2.0",
"doctrine/orm": ">=2.2.3",
}
}
30. Fully Qualified Name (FQN)
∖Doctrine∖DBAL∖Driver
∖Twig_Lexer
[lib_path]/Doctrine/DBAL/Driver.php
File
31. Fully Qualified Name (FQN)
∖Doctrine∖DBAL∖Driver
∖Twig_Lexer
[lib_path]/Doctrine/DBAL/Driver.php
[lib_path]/Twig/Lexer.php
File
142. CRLF
Request = Request-Line
*(header CRLF)
CRLF
[ message-body ]
General
156. Hypertext Transfer Protocol
$_GET
GET /index.php HTTP/1.1 $_POST
Host: test.com
Accept-Language:en;q=0.8 $_COOKIE
Accept-Encoding:gzip
User-Agent: Mozilla/5.0 $_FILES
$_SERVER
157. Hypertext Transfer Protocol
$_GET query
request
GET /index.php HTTP/1.1 $_POST cookies
Host: test.com files
Accept-Language:en;q=0.8 $_COOKIE server
Accept-Encoding:gzip headers
User-Agent: Mozilla/5.0 $_FILES getHost
getClientIp
$_SERVER ...
248. CRLF
Response = Status-Line
*(header CRLF)
CRLF
[ message-body ]
General
262. Hypertext Transfer Protocol
Headers HTTP/1.1 200 OK
Version Content-type: text/html
Date:Sun, 3 Mar 2013 07:10:42 GMT
Content
Status code !DOCTYPE HTML
Status text html lang=es
head
Charset meta charset=utf-8
... ...
264. Components
Vendors
+ ➕ Bundles
Bridges
---------------------
Full-stack
277. “A bundle is a directory that has
a well-defined structure and can
host anything from classes to
controllers and web resources.”
Source: symfony.com
281. Example: The Twig Bridge
adds useful functions to use
forms, routing, security and
translations.
282. Example: The Twig Bridge
adds useful functions to use
forms, routing, security and
form_enctype translations.
form_widget
form_errors
form_label
form_row
form_rest
csrf_token
283. Example: The Twig Bridge
adds useful functions to use
forms, routing, security and
form_enctype url translations.
form_widget path
form_errors
form_label
form_row
form_rest
csrf_token
284. Example: The Twig Bridge
adds useful functions to use
forms, routing, security and
form_enctype url translations. is_granted
form_widget path
form_errors
form_label
form_row
form_rest
csrf_token
285. Example: The Twig Bridge
adds useful functions to use
forms, routing, security and
form_enctype url translations. is_granted
form_widget path
trans
form_errors
transchoice
form_label
form_row
form_rest
csrf_token
291. Mediator pattern:
decouple a Producer from a
Consumer
Consumer
Producer Mediator Consumer
Consumer
addListener()
dispatch()
http://goo.gl/Fr16Z
Mediators - Programming With
Anthony
294. If any listener return a
Response object, all other
listeners won't be called.
300. Goal: build a Response
object from the return value
of the Controller
303. Allow to modify or replace the
Response object after its creation
i.e.
310. Allow to modify or replace the
Response object after its creation
i.e.