Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
An Introduction to Symfony2
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Geoffrey Tran
July 03, 2012
Programming
220
1
Share
An Introduction to Symfony2
A simple introduction to Symfony2 for LoneStarPHP11
Geoffrey Tran
July 03, 2012
More Decks by Geoffrey Tran
See All by Geoffrey Tran
Stop Exposing Yourself: Exploits, Attacks and Defenses
geoff
2
460
Other Decks in Programming
See All in Programming
AI Agent と正しく分析するための環境作り
yoshyum
3
610
柔軟なPDFレイアウトエディタを支える型システム設計 — Discriminated UnionとConditional Typeの実践
minako__ph
4
610
tsserverとは何だったのか、これからどうなるのか
nowaki28
1
400
AIエージェントの隔離技術の徹底比較
kawayu
0
430
密結合なバックエンドから TypeScript のコードを生成する
kemuridama
1
350
inferと仲良くなる10分間
ryokatsuse
1
250
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
9
2.3k
TSKaigi2026-静的解析への投資がAI時代のコード品質を支える ── カスタムESLintルールの設計と運用
hayatokudou
6
1.1k
AlarmKitで明後日起きれるアラームアプリを作る
trickart
0
150
プロパティの順序で型推論が壊れる!? TypeScript6.0の修正からContext-Sensitivityの仕組みを追う
bicstone
2
1.1k
Signal Forms: Beyond the Basics @ngBaguette 2026 in Paris
manfredsteyer
PRO
0
110
サークル参加から学ぶ、小さな事業の回し方
yuzneri
0
240
Featured
See All Featured
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
270
Bash Introduction
62gerente
615
210k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
170
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
Typedesign – Prime Four
hannesfritz
42
3k
How to Think Like a Performance Engineer
csswizardry
28
2.6k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
340
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
200
Transcript
!Symfony2:!It’s!Play!Time! @geoffreytran! www.linkedin.com/in/geoffreytran!
What!is!Symfony2?! It!simply!solves!your!difficult!redundant!problems! …!and!gets!out!of!your!way!
You!are!not!boxed!in…!
…!easy!to!get!started,!yet!powerful!and!flexible!for! advanced!users!
Pre!Zend_ApplicaNon!Bootstrap! Index.php!
Post!Zend_ApplicaNon! Index.php!
“The core architecture is now stable…” – Fabien Potencier hPp://symfony.com/blog/symfony2QfinalQversionQweQareQnotQthereQyet!
In!development!since!December!2009!
A!lot!can!happen! in!a!year! A"baby?"
None
Top"2%"of"projects"on"Ohloh"
325"Bundles"Published" h>p://symfony2bundles.org/"
What!exactly!is!a!bundle?! A!bundle!is!like!a!plugin! …!except!Symfony2!itself!is!made!up!of!bundles!
“I!was!using!the!same!idea!by!organizing!my!code!in![zend!framework]! modules,!but!this!is!really!painful”! QQ!tawfekov!via!StackOverflow! ! hPp://stackoverflow.com/quesNons/5053369/doQyouQthinkQzendQframeworkQmissesQtheQsymfonysQbundleQprinciple!
Nothing!like!Symfony1!
Less!Magic! config_autoload.yml.php!
Explicit!ConfiguraNon! app/AppKernel.php!
Doctrine2! Doctrine2:!User.php! Doctrine!1.2:!User.php!
Decoupled!design!
None
None
None
None
What makes up Symfony2? ConfiguraNon! Kernel! Directory! Structure! Symfony!Framework!Bundles! Symfony!Components!
Getting started with Symfony2 distributions Similar!to!Linux!distribuNons!
hPp://symfony.com/download!
#!cd!~/Projects/LoneStarPHP! #!tar!xvzf!/path/to/Symfony_Standard_Vendors_2.0.0BETA4.tgz! Extract to your web directory
Check requirements hPp://yourhost/LoneStarPHP/web/config.php! Not!accessing!from!localhost?!! Remove!the!security!check! from:! web/config.php" web/app_dev.php"
Check requirements hPp://yourhost/LoneStarPHP/web/config.php!
Check requirements hPp://yourhost/LoneStarPHP/web/config.php!
Check requirements hPp://yourhost/LoneStarPHP/web/config.php!
Check requirements hPp://yourhost/LoneStarPHP/web/config.php!
Configure the database connection hPp://yourhost/LoneStarPHP/web/app_dev.php/_configurator/step/0! You!can!write!your! own!configuraNon! files!instead!
Yay, Welcome to Symfony! hPp://yourhost/LoneStarPHP/web/app_dev.php!
What!makes!a!page?! /hello/world" A!Route! !/hello/{name}" A!Controller! !A!PHP!funcNon! A!Response! !“<h1>Hello!World!</h1>”!
Step!1:!Create!a!route! /hello/world" File:"app/config/rouKng.yml" ! ! *!RouNng!can!also!be!defined!with!XML,!PHP!and!as!annotaNons! AcmeDemoBundle:LoneStar:hello!! maps!to! !Acme\DemoBundle\Controller\LoneStarController::helloAcNon()!
Step!2:!Create!a!controller! /hello/world" File:"src/Acme/DemoBundle/Controller/LoneStarController.php" ! ! *!At!its!simplest,!a!controller!is!just!a!funcNon!
Step!2:!Create!a!controller! /hello/world" File:"src/Acme/DemoBundle/Controller/LoneStarController.php" ! ! File:"app/config/rouKng.yml" ! !
/hello/world! hPp://yourhost/LoneStarPHP/web/app_dev.php/hello/world!
Great…!! But!HTML!in!controllers?!&@*$%!""
Meet!Twig" hPp://www.twigQproject.org! src/Acme/DemoBundle/Resources/views/LoneStar/hello.html.twig! src/Acme/DemoBundle/Controller/LoneStarController.php!
Hello!World!" hPp://yourhost/LoneStarPHP/web/app_dev.php/hello/world!
Digging!Deeper" hPp://yourhost/LoneStarPHP/web/app_dev.php/hello/world!
Digging!Deeper" hPp://yourhost/LoneStarPHP/web/app_dev.php/hello/world!
Do!less!work! /hello/world" File:"src/Acme/DemoBundle/Controller/LoneStarController.php" ! !
Give"it"a"try…"