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
Geoffrey Tran
July 03, 2012
Programming
220
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
350
「エンジニアインターン、どうやって取った?」準備のリアルを語るLT会 Progate BAR
akiomatic
0
130
さぁV100、メモリをお食べ・・・
nilpe
0
140
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
エージェンティックRAGにAWSで入門しよう!
har1101
8
1.6k
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
570
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
550
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
11
4.2k
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
11
5.7k
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
240
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
140
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
270
Featured
See All Featured
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
390
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
730
Joys of Absence: A Defence of Solitary Play
codingconduct
1
390
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Navigating Weather and Climate Data
rabernat
0
220
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
850
How to Ace a Technical Interview
jacobian
281
24k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.3k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
A better future with KSS
kneath
240
18k
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…"