Symfony - Introduction
-
Upload
piers-warmers -
Category
Documents
-
view
94 -
download
1
Transcript of Symfony - Introduction
![Page 1: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/1.jpg)
A Better Way to Build
Thursday, 27 September 12
![Page 2: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/2.jpg)
Piers Warmers
@warmers
@pierswarmers
Thursday, 27 September 12
![Page 3: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/3.jpg)
What’s on tonight?
Thursday, 27 September 12
![Page 4: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/4.jpg)
Session 1.
Thursday, 27 September 12
![Page 5: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/5.jpg)
Session 1.
• Introduction
Thursday, 27 September 12
![Page 6: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/6.jpg)
Session 1.
• Introduction
• What is Symfony?
Thursday, 27 September 12
![Page 7: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/7.jpg)
Session 1.
• Introduction
• What is Symfony?
• Core concepts
Thursday, 27 September 12
![Page 8: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/8.jpg)
Session 1.
• Introduction
• What is Symfony?
• Core concepts
• A typical application
Thursday, 27 September 12
![Page 9: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/9.jpg)
Session 1.
• Introduction
• What is Symfony?
• Core concepts
• A typical application
• Lets code!
Thursday, 27 September 12
![Page 10: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/10.jpg)
Session 2.
Thursday, 27 September 12
![Page 11: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/11.jpg)
Session 2.
• CRUD and MVC (with the model)
Thursday, 27 September 12
![Page 12: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/12.jpg)
Session 2.
• CRUD and MVC (with the model)
• Cleaning up our interfaces
Thursday, 27 September 12
![Page 13: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/13.jpg)
Session 2.
• CRUD and MVC (with the model)
• Cleaning up our interfaces
• Forms and validation
Thursday, 27 September 12
![Page 14: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/14.jpg)
Session 2.
• CRUD and MVC (with the model)
• Cleaning up our interfaces
• Forms and validation
• Services and dependancy injection
Thursday, 27 September 12
![Page 15: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/15.jpg)
Session 2.
• CRUD and MVC (with the model)
• Cleaning up our interfaces
• Forms and validation
• Services and dependancy injection
• An overview of security
Thursday, 27 September 12
![Page 16: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/16.jpg)
Session 2.
• CRUD and MVC (with the model)
• Cleaning up our interfaces
• Forms and validation
• Services and dependancy injection
• An overview of security
• Using Symfony components without symfony
Thursday, 27 September 12
![Page 17: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/17.jpg)
Session 2.
• CRUD and MVC (with the model)
• Cleaning up our interfaces
• Forms and validation
• Services and dependancy injection
• An overview of security
• Using Symfony components without symfony
Thursday, 27 September 12
![Page 18: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/18.jpg)
ce qui est Symfony?
Thursday, 27 September 12
![Page 19: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/19.jpg)
Symfony is…
Thursday, 27 September 12
![Page 20: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/20.jpg)
Symfony is…
• a full stack framework (PHP 5.3+)
Thursday, 27 September 12
![Page 21: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/21.jpg)
“Symfony is a reusable set of standalone, decoupled and cohesive PHP components that solve common
web development problems”Dries Buytaert (Founder of Drupal)
Thursday, 27 September 12
![Page 22: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/22.jpg)
Problems?
Thursday, 27 September 12
![Page 23: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/23.jpg)
Problems?
• Connect requests to business logic (route ➜ code)
Thursday, 27 September 12
![Page 24: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/24.jpg)
Problems?
• Connect requests to business logic (route ➜ code)
• Handle environment configuration (dev, test, prod)
Thursday, 27 September 12
![Page 25: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/25.jpg)
Problems?
• Connect requests to business logic (route ➜ code)
• Handle environment configuration (dev, test, prod)
• Secure an application (authentication, firewalls)
Thursday, 27 September 12
![Page 26: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/26.jpg)
Problems?
• Connect requests to business logic (route ➜ code)
• Handle environment configuration (dev, test, prod)
• Secure an application (authentication, firewalls)
• Render a response (templates)
Thursday, 27 September 12
![Page 27: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/27.jpg)
Problems?
• Connect requests to business logic (route ➜ code)
• Handle environment configuration (dev, test, prod)
• Secure an application (authentication, firewalls)
• Render a response (templates)
• Speed things up (compiling, caching, ESI, proxies)
Thursday, 27 September 12
![Page 28: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/28.jpg)
Problems?
• Connect requests to business logic (route ➜ code)
• Handle environment configuration (dev, test, prod)
• Secure an application (authentication, firewalls)
• Render a response (templates)
• Speed things up (compiling, caching, ESI, proxies)
• I18N & L10N (translations, regional formatting)
Thursday, 27 September 12
![Page 29: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/29.jpg)
Standalone, decoupled?
Thursday, 27 September 12
![Page 30: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/30.jpg)
Symfony & Components
BrowserKit
ClassLoader
Config
Console
CssSelector
DependencyInjection
DomCrawler
EventDispatcher
Finder
Form
HttpFoundation
HttpKernel
Locale
Process
Routing
Security
Serializer
Templating
Translation
Validator
Yaml
includes
See: http://symfony.com/components
Thursday, 27 September 12
![Page 31: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/31.jpg)
“Let's try to eliminate the NIH
syndrome in the PHP world!”Fabien Potencier (Founder of Symfony)
Thursday, 27 September 12
![Page 32: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/32.jpg)
Drupal & Symfony
BrowserKit
ClassLoader
Config
Console
CssSelector
DependencyInjection
DomCrawler
EventDispatcher
Finder
Form
HttpFoundation
HttpKernel
Locale
Process
Routing
Security
Serializer
Templating
Translation
Validator
Yaml
using
Version 8+
Thursday, 27 September 12
![Page 33: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/33.jpg)
https://github.com/drupal/drupal/blob/8.x/index.php
Thursday, 27 September 12
![Page 34: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/34.jpg)
Symfony is…
• a full stack framework (PHP 5.3+) ✓
Thursday, 27 September 12
![Page 35: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/35.jpg)
Symfony is…
• a full stack framework (PHP 5.3+) ✓
• application methodology (best practices, standards)
Thursday, 27 September 12
![Page 36: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/36.jpg)
“A most important, but also most elusive, aspect of any tool is its
influence on the habits of those who
train themselves in its use.”Edsger Dijkstra (Computer Scientist)
Thursday, 27 September 12
![Page 37: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/37.jpg)
Influence by example…
Thursday, 27 September 12
![Page 38: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/38.jpg)
Influence by example…
• a blueprint for applications (shape, vernacular)
Thursday, 27 September 12
![Page 39: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/39.jpg)
Influence by example…
• a blueprint for applications (shape, vernacular)
• best practices (quality, testing)
Thursday, 27 September 12
![Page 40: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/40.jpg)
Influence by example…
• a blueprint for applications (shape, vernacular)
• best practices (quality, testing)
• standardisation and consistency (PSR-0, PSR-1, PSR-2)
Thursday, 27 September 12
![Page 41: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/41.jpg)
Symfony is…
• a full stack framework (PHP 5.3+) ✓
• application methodology (best practices, standards) ✓
Thursday, 27 September 12
![Page 42: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/42.jpg)
Symfony is…
• a full stack framework (PHP 5.3+) ✓
• application methodology (best practices, standards) ✓
• an enthusiastic community (it’s about people)
Thursday, 27 September 12
![Page 43: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/43.jpg)
…and theres lots of them!
Thursday, 27 September 12
![Page 44: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/44.jpg)
…and theres lots of them!
• large community (http://connect.sensiolabs.com)
Thursday, 27 September 12
![Page 45: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/45.jpg)
…and theres lots of them!
• large community (http://connect.sensiolabs.com)
• regional events (SymfonyLive - Paris, London, Berlin, San Francisco)
Thursday, 27 September 12
![Page 46: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/46.jpg)
…and theres lots of them!
• large community (http://connect.sensiolabs.com)
• regional events (SymfonyLive - Paris, London, Berlin, San Francisco)
• involved (http://symfony.com/contributors)
Thursday, 27 September 12
![Page 47: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/47.jpg)
…and theres lots of them!
• large community (http://connect.sensiolabs.com)
• regional events (SymfonyLive - Paris, London, Berlin, San Francisco)
• involved (http://symfony.com/contributors)
• like to share (open source, permissive MIT style)
Thursday, 27 September 12
![Page 48: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/48.jpg)
Symfony is…
• a full stack framework (PHP 5.3+) ✓
• application methodology (best practices, standards) ✓
Thursday, 27 September 12
![Page 49: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/49.jpg)
Symfony is…
• a full stack framework (PHP 5.3+) ✓
• application methodology (best practices, standards) ✓
• an enthusiastic community (it’s about people) ✓
Thursday, 27 September 12
![Page 50: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/50.jpg)
Lets Go!Time to setup a project.
Thursday, 27 September 12
![Page 51: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/51.jpg)
Installation in three steps
Thursday, 27 September 12
![Page 52: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/52.jpg)
Installation in three steps
• get composer
Thursday, 27 September 12
![Page 53: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/53.jpg)
Installation in three steps
• get composer
• create project
Thursday, 27 September 12
![Page 54: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/54.jpg)
Installation in three steps
• get composer
• create project
• start server
Thursday, 27 September 12
![Page 55: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/55.jpg)
Dependency management
Satis
Thursday, 27 September 12
![Page 56: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/56.jpg)
So the installation in three steps…
Thursday, 27 September 12
![Page 57: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/57.jpg)
So the installation in three steps…
Thursday, 27 September 12
![Page 58: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/58.jpg)
Get composer - it’s crazy simple!
Thursday, 27 September 12
![Page 59: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/59.jpg)
Get composer - it’s crazy simple!
Thursday, 27 September 12
![Page 60: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/60.jpg)
Get composer - it’s crazy simple!
Thursday, 27 September 12
![Page 61: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/61.jpg)
Get composer - it’s crazy simple!
Thursday, 27 September 12
![Page 62: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/62.jpg)
Create a project
Thursday, 27 September 12
![Page 63: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/63.jpg)
Create a project
Thursday, 27 September 12
![Page 64: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/64.jpg)
Create a project
Thursday, 27 September 12
![Page 65: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/65.jpg)
Create a project
Thursday, 27 September 12
![Page 66: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/66.jpg)
Run the server, we’re online!
Thursday, 27 September 12
![Page 67: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/67.jpg)
Lets look inside ./demo1
Thursday, 27 September 12
![Page 68: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/68.jpg)
Lets look inside ./demo1
Thursday, 27 September 12
![Page 69: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/69.jpg)
The important parts…
Thursday, 27 September 12
![Page 70: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/70.jpg)
The important parts…
• app ➜ AppKernal, cache, configuration, logs, console
Thursday, 27 September 12
![Page 71: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/71.jpg)
The important parts…
• app ➜ AppKernal, cache, configuration, logs, console
• composer.json ➜ dependancy map
Thursday, 27 September 12
![Page 72: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/72.jpg)
The important parts…
• app ➜ AppKernal, cache, configuration, logs, console
• composer.json ➜ dependancy map
• composer.lock ➜ what was actually installed
Thursday, 27 September 12
![Page 73: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/73.jpg)
The important parts…
• app ➜ AppKernal, cache, configuration, logs, console
• composer.json ➜ dependancy map
• composer.lock ➜ what was actually installed
• src ➜ you’re code goes here
Thursday, 27 September 12
![Page 74: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/74.jpg)
The important parts…
• app ➜ AppKernal, cache, configuration, logs, console
• composer.json ➜ dependancy map
• composer.lock ➜ what was actually installed
• src ➜ you’re code goes here
• vendor ➜ other peoples code goes here (via composer)
Thursday, 27 September 12
![Page 75: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/75.jpg)
The important parts…
• app ➜ AppKernal, cache, configuration, logs, console
• composer.json ➜ dependancy map
• composer.lock ➜ what was actually installed
• src ➜ you’re code goes here
• vendor ➜ other peoples code goes here (via composer)
• web ➜ server loads app.php here which loads…
Thursday, 27 September 12
![Page 76: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/76.jpg)
The important parts…
• app ➜ AppKernal, cache, configuration, logs, console
• composer.json ➜ dependancy map
• composer.lock ➜ what was actually installed
• src ➜ you’re code goes here
• vendor ➜ other peoples code goes here (via composer)
• web ➜ server loads app.php here which loads…
AppKernal.php
Thursday, 27 September 12
![Page 77: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/77.jpg)
In the browser
Thursday, 27 September 12
![Page 78: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/78.jpg)
The console
Thursday, 27 September 12
![Page 79: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/79.jpg)
./app/console
Thursday, 27 September 12
![Page 80: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/80.jpg)
The console
Thursday, 27 September 12
![Page 81: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/81.jpg)
The console
• Time savers: build models, controllers and bundles
Thursday, 27 September 12
![Page 82: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/82.jpg)
The console
• Time savers: build models, controllers and bundles
• Manage cache removal
Thursday, 27 September 12
![Page 83: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/83.jpg)
The console
• Time savers: build models, controllers and bundles
• Manage cache removal
• Update database schema
Thursday, 27 September 12
![Page 84: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/84.jpg)
The console
• Time savers: build models, controllers and bundles
• Manage cache removal
• Update database schema
• Send spooled emails
Thursday, 27 September 12
![Page 85: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/85.jpg)
The console
• Time savers: build models, controllers and bundles
• Manage cache removal
• Update database schema
• Send spooled emails
• Build you own CLI tasks
Thursday, 27 September 12
![Page 86: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/86.jpg)
The console
• Time savers: build models, controllers and bundles
• Manage cache removal
• Update database schema
• Send spooled emails
• Build you own CLI tasks
• Run the PHP test server
Thursday, 27 September 12
![Page 87: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/87.jpg)
Built in PHP server is good for quick testing but... don’t use in production!
Thursday, 27 September 12
![Page 88: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/88.jpg)
What’s my normal setup?
Thursday, 27 September 12
![Page 89: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/89.jpg)
What’s my normal setup?
• PHP 5.4.6
Thursday, 27 September 12
![Page 90: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/90.jpg)
What’s my normal setup?
• PHP 5.4.6
• MySQL 5.5.25a MySQL Community Server
Thursday, 27 September 12
![Page 91: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/91.jpg)
What’s my normal setup?
• PHP 5.4.6
• MySQL 5.5.25a MySQL Community Server
• Apache HTTP Server 2.2.22
Thursday, 27 September 12
![Page 92: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/92.jpg)
Let’s look at the config…
Thursday, 27 September 12
![Page 93: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/93.jpg)
Configure: hosts
Thursday, 27 September 12
![Page 94: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/94.jpg)
Configure: Apache HTTP
Thursday, 27 September 12
![Page 95: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/95.jpg)
Configure: MySQL CE
Thursday, 27 September 12
![Page 96: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/96.jpg)
Through Apache
Thursday, 27 September 12
![Page 97: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/97.jpg)
The Web Debug Toolbar
Thursday, 27 September 12
![Page 98: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/98.jpg)
Web Debug Toolbar
Thursday, 27 September 12
![Page 99: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/99.jpg)
Web Debug Toolbar
• Displays resource usage
Thursday, 27 September 12
![Page 100: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/100.jpg)
Web Debug Toolbar
• Displays resource usage
• Monitors code execution times
Thursday, 27 September 12
![Page 101: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/101.jpg)
Web Debug Toolbar
• Displays resource usage
• Monitors code execution times
• Presents info on session, logs, exceptions
Thursday, 27 September 12
![Page 102: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/102.jpg)
Web Debug Toolbar
• Displays resource usage
• Monitors code execution times
• Presents info on session, logs, exceptions
• Provides insight into persistence layer
Thursday, 27 September 12
![Page 103: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/103.jpg)
Web Debug Toolbar
• Displays resource usage
• Monitors code execution times
• Presents info on session, logs, exceptions
• Provides insight into persistence layer
• Good for showing off in meetings
Thursday, 27 September 12
![Page 104: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/104.jpg)
“Hello world!”The Demo App
Thursday, 27 September 12
![Page 105: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/105.jpg)
What’s just happened?
Route
htpp://…/hello/SydPHP
Request
Controller
View
Thursday, 27 September 12
![Page 106: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/106.jpg)
What’s just happened?
/demo/hello/{name}
htpp://…/demo/hello/SydPHP
authentication, authorisation, resolving etc…
AcmeDemoBundle->helloAction($name)
hello.html.twig
layout.html.twig
Thursday, 27 September 12
![Page 107: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/107.jpg)
./app/config/routing_dev.yml
Thursday, 27 September 12
![Page 108: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/108.jpg)
./src/Acme/DemoBundle/Controller/DemoController.php
Thursday, 27 September 12
![Page 109: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/109.jpg)
./src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig
Thursday, 27 September 12
![Page 110: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/110.jpg)
A template enginefor PHP?
Thursday, 27 September 12
![Page 111: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/111.jpg)
Twig template engine
Thursday, 27 September 12
![Page 112: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/112.jpg)
Twig template engine
• Fast (compiled to optimised PHP)
Thursday, 27 September 12
![Page 113: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/113.jpg)
Twig template engine
• Fast (compiled to optimised PHP)
• Concise (easy to learn, clean, designers will love you)
Thursday, 27 September 12
![Page 114: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/114.jpg)
For example:
Output in PHP:
Output in Twig:
Thursday, 27 September 12
![Page 115: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/115.jpg)
For example:
Output in PHP:
Output in Twig:
Thursday, 27 September 12
![Page 116: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/116.jpg)
Twig templating
• Fast (compiled to optimised PHP)
• Concise (easy to learn, clean, designers will love you)
Thursday, 27 September 12
![Page 117: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/117.jpg)
Twig templating
• Fast (compiled to optimised PHP)
• Concise (easy to learn, clean, designers will love you)
• Secure (escaped output, sandboxed)
Thursday, 27 September 12
![Page 118: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/118.jpg)
Twig templating
• Fast (compiled to optimised PHP)
• Concise (easy to learn, clean, designers will love you)
• Secure (escaped output, sandboxed)
• Extendable (custom tags and filters)
Thursday, 27 September 12
![Page 119: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/119.jpg)
Twig templating
• Fast (compiled to optimised PHP)
• Concise (easy to learn, clean, designers will love you)
• Secure (escaped output, sandboxed)
• Extendable (custom tags and filters)
• Helps enforce SoC (helps keep templates for display only)
Thursday, 27 September 12
![Page 120: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/120.jpg)
Twig templating
• Fast (compiled to optimised PHP)
• Concise (easy to learn, clean, designers will love you)
• Secure (escaped output, sandboxed)
• Extendable (custom tags and filters)
• Helps enforce SoC (helps keep templates for display only)
• Totally optional (you can still use PHP or both)
Thursday, 27 September 12
![Page 121: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/121.jpg)
Twig templating
• Fast (compiled to optimised PHP)
• Concise (easy to learn, clean, designers will love you)
• Secure (escaped output, sandboxed)
• Extendable (custom tags and filters)
• Helps enforce SoC (helps keep templates for display only)
• Totally optional (you can still use PHP or both)
Thursday, 27 September 12
![Page 122: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/122.jpg)
Twig templates can extend Layouts
Thursday, 27 September 12
![Page 123: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/123.jpg)
(simplified)./src/Acme/DemoBundle/Resources/views/layout.html.twig
Thursday, 27 September 12
![Page 124: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/124.jpg)
Coming up…
Thursday, 27 September 12
![Page 125: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/125.jpg)
Coming up…
• CRUD and MVC (with the model)
Thursday, 27 September 12
![Page 126: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/126.jpg)
Coming up…
• CRUD and MVC (with the model)
• Cleaning up our interfaces
Thursday, 27 September 12
![Page 127: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/127.jpg)
Coming up…
• CRUD and MVC (with the model)
• Cleaning up our interfaces
• Forms and validation
Thursday, 27 September 12
![Page 128: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/128.jpg)
Coming up…
• CRUD and MVC (with the model)
• Cleaning up our interfaces
• Forms and validation
• Services and dependancy injection
Thursday, 27 September 12
![Page 129: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/129.jpg)
Coming up…
• CRUD and MVC (with the model)
• Cleaning up our interfaces
• Forms and validation
• Services and dependancy injection
• An overview of security
Thursday, 27 September 12
![Page 130: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/130.jpg)
Coming up…
• CRUD and MVC (with the model)
• Cleaning up our interfaces
• Forms and validation
• Services and dependancy injection
• An overview of security
• Using Symfony components without symfony
Thursday, 27 September 12
![Page 131: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/131.jpg)
big thanks to
SensioLabs
PizzaTime!
Thursday, 27 September 12
![Page 132: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/132.jpg)
Quick recap…
Thursday, 27 September 12
![Page 133: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/133.jpg)
Quick recap…
• We have a simple application setup
Thursday, 27 September 12
![Page 134: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/134.jpg)
Quick recap…
• We have a simple application setup
• We’ve looked at:
Thursday, 27 September 12
![Page 135: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/135.jpg)
Quick recap…
• We have a simple application setup
• We’ve looked at:
• routing
Thursday, 27 September 12
![Page 136: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/136.jpg)
Quick recap…
• We have a simple application setup
• We’ve looked at:
• routing
• controllers
Thursday, 27 September 12
![Page 137: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/137.jpg)
Quick recap…
• We have a simple application setup
• We’ve looked at:
• routing
• controllers
• templates
Thursday, 27 September 12
![Page 138: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/138.jpg)
Quick recap…
• We have a simple application setup
• We’ve looked at:
• routing
• controllers
• templates
• Lets build a simple CRUD application
Thursday, 27 September 12
![Page 139: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/139.jpg)
CRUD and MVC
Route
htpp://…/products
Request
Controller
Model View
Thursday, 27 September 12
![Page 140: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/140.jpg)
Doctrine DBAL and ORM
Thursday, 27 September 12
![Page 141: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/141.jpg)
Before we get started…
Thursday, 27 September 12
![Page 142: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/142.jpg)
Bundles & namespacesare your friends…
Thursday, 27 September 12
![Page 143: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/143.jpg)
Bundles & namespacesare your friends…
image by sergiu_bacioiu @
Thursday, 27 September 12
![Page 144: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/144.jpg)
• Make life simpler (after some wtf moments)
Thursday, 27 September 12
![Page 145: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/145.jpg)
• Make life simpler (after some wtf moments)
• Should follow FIG standards (www.php-fig.org)
Thursday, 27 September 12
![Page 146: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/146.jpg)
• Make life simpler (after some wtf moments)
• Should follow FIG standards (www.php-fig.org)
• Makes autoloading a breeze (ClassLoader component)
See here: http://symfony.com/doc/current/components/class_loader.html
Thursday, 27 September 12
![Page 147: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/147.jpg)
• \Zend\Mail\Message ➜
/path/to/project/lib/vendor/Zend/Mail/Message.php
Thursday, 27 September 12
![Page 148: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/148.jpg)
• \Zend\Mail\Message ➜
/path/to/project/lib/vendor/Zend/Mail/Message.php
• \Symfony\Core\Request ➜
/path/to/project/lib/vendor/Symfony/Core/Request.php
Thursday, 27 September 12
![Page 149: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/149.jpg)
Lets create our own bundleAcme/Bundle/BlogBundle
Thursday, 27 September 12
![Page 150: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/150.jpg)
./app/config/parameters.ymlGenerate the new bundle
Thursday, 27 September 12
![Page 151: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/151.jpg)
./app/config/parameters.ymlGenerate the new bundle
Thursday, 27 September 12
![Page 152: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/152.jpg)
The modelLets create our Doctrine entity
Thursday, 27 September 12
![Page 153: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/153.jpg)
./app/config/parameters.ymlGenerate the new entity
Thursday, 27 September 12
![Page 154: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/154.jpg)
The CRUD logicLets create our Controller
Thursday, 27 September 12
![Page 155: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/155.jpg)
./app/config/parameters.ymlGenerate the new entity
Thursday, 27 September 12
![Page 156: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/156.jpg)
2 Errors
Thursday, 27 September 12
![Page 157: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/157.jpg)
Oh snap: part 1
Thursday, 27 September 12
![Page 158: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/158.jpg)
./app/config/parameters.yml will fix this
Thursday, 27 September 12
![Page 159: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/159.jpg)
Oh snap: part 2
Thursday, 27 September 12
![Page 160: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/160.jpg)
Update the databaseThere’s a task for that.
Thursday, 27 September 12
![Page 161: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/161.jpg)
./app/config/parameters.ymlGenerate the update query
Thursday, 27 September 12
![Page 162: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/162.jpg)
Looks good, sort of?
Thursday, 27 September 12
![Page 163: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/163.jpg)
Cleaning up
Thursday, 27 September 12
![Page 164: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/164.jpg)
Cleaning up
• Add our new layout template (apply it to views)
Thursday, 27 September 12
![Page 165: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/165.jpg)
Cleaning up
• Add our new layout template (apply it to views)
• Add some CSS (quick look at asset linking)
Thursday, 27 September 12
![Page 166: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/166.jpg)
Cleaning up
• Add our new layout template (apply it to views)
• Add some CSS (quick look at asset linking)
• Discover Assetic (images, css, javascript etc…)
Thursday, 27 September 12
![Page 167: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/167.jpg)
./app/config/parameters.ymlLets use this simple template
Thursday, 27 September 12
![Page 168: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/168.jpg)
./app/config/parameters.ymlAnd apply it to our templates
Thursday, 27 September 12
![Page 169: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/169.jpg)
Why this?{{ asset('bundles/acmeblog/css/demo.css') }}
Thursday, 27 September 12
![Page 170: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/170.jpg)
Why this?{{ asset('bundles/acmeblog/css/demo.css') }}
• Can prefix different paths (dev vs prod)
Thursday, 27 September 12
![Page 171: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/171.jpg)
Why this?{{ asset('bundles/acmeblog/css/demo.css') }}
• Can prefix different paths (dev vs prod)
• Can be used for cache busting (v1, v2, v3, etc…)
Thursday, 27 September 12
![Page 172: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/172.jpg)
./app/config/parameters.yml./app/config/config.yml
Thursday, 27 September 12
![Page 173: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/173.jpg)
Assetic is the next step
Thursday, 27 September 12
![Page 174: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/174.jpg)
Assetic is the next step
• Advanced filters:
Thursday, 27 September 12
![Page 175: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/175.jpg)
Assetic is the next step
• Advanced filters:
• Images (jpegoptim, optipng)
Thursday, 27 September 12
![Page 176: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/176.jpg)
Assetic is the next step
• Advanced filters:
• Images (jpegoptim, optipng)
• CSS (combine and compress)
Thursday, 27 September 12
![Page 177: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/177.jpg)
Assetic is the next step
• Advanced filters:
• Images (jpegoptim, optipng)
• CSS (combine and compress)
• JS (combine and compress)
Thursday, 27 September 12
![Page 178: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/178.jpg)
Assetic is the next step
• Advanced filters:
• Images (jpegoptim, optipng)
• CSS (combine and compress)
• JS (combine and compress)
• LESS, SASS (compile, combine, compress)
Thursday, 27 September 12
![Page 179: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/179.jpg)
./app/config/parameters.ymlUpdate the layout…
Thursday, 27 September 12
![Page 180: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/180.jpg)
Forms & Validation
Thursday, 27 September 12
![Page 181: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/181.jpg)
Forms Widgets
Thursday, 27 September 12
![Page 182: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/182.jpg)
./app/config/parameters.ymlSimple, elegant presentation
Thursday, 27 September 12
![Page 183: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/183.jpg)
Constraints & Assertions
Thursday, 27 September 12
![Page 184: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/184.jpg)
./app/config/parameters.ymlAssertions in annotations
Thursday, 27 September 12
![Page 185: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/185.jpg)
Services
Thursday, 27 September 12
![Page 186: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/186.jpg)
Lets improve Postwho’s setting the “created_at” property?
Thursday, 27 September 12
![Page 187: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/187.jpg)
./app/config/parameters.ymlIn the model?
Thursday, 27 September 12
![Page 188: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/188.jpg)
./app/config/parameters.ymlOn the object?
Thursday, 27 September 12
![Page 189: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/189.jpg)
Maybe there’s a better way?
Thursday, 27 September 12
![Page 190: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/190.jpg)
./app/config/parameters.ymlServices are global toolkits
Thursday, 27 September 12
![Page 191: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/191.jpg)
Service ContainersDependancy Injection
Thursday, 27 September 12
![Page 192: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/192.jpg)
“Dependency injection is a software design pattern that allows a choice of component to be made at run-time rather than
compile time. This can be used, for example, as a simple way to load plugins dynamically or to choose mock objects in test
environments vs. real objects in production environments.”Wikipedia
Thursday, 27 September 12
![Page 193: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/193.jpg)
Finishing up
Thursday, 27 September 12
![Page 194: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/194.jpg)
Finishing up
• Security (broad topic, demo app has an example)
Thursday, 27 September 12
![Page 195: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/195.jpg)
Finishing up
• Security (broad topic, demo app has an example)
• Firewalls (protect areas of application via routes)
Thursday, 27 September 12
![Page 196: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/196.jpg)
Finishing up
• Security (broad topic, demo app has an example)
• Firewalls (protect areas of application via routes)
• Authentication providers (in memory, HTTP, build you own, FOSUserBundle)
Thursday, 27 September 12
![Page 197: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/197.jpg)
Finishing up
• Security (broad topic, demo app has an example)
• Firewalls (protect areas of application via routes)
• Authentication providers (in memory, HTTP, build you own, FOSUserBundle)
• Authorisation (ACL in config or DB)
Thursday, 27 September 12
![Page 198: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/198.jpg)
Out of time…Thursday, 27 September 12
![Page 199: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/199.jpg)
A huge thanks to…
• SensioLabs: t-shirts, pizza, support
• SydPHP: organisation, support
Thursday, 27 September 12
![Page 200: Symfony - Introduction](https://reader031.fdocuments.in/reader031/viewer/2022013108/55a6b9e31a28abdc088b4679/html5/thumbnails/200.jpg)
Slides will be up on Speaker Deck shortly…
@warmers
Thursday, 27 September 12