In the short attention span of most fellow PHP developer’s, here the first 5 great reasons to use Symfony. (Update: part 2 is here.) This is by no means a full explanation of Symfony, but just enough to get you running over to the documentation to learn more.
Few general highlights first:
- Enterprise Ready – (used for Yahoo bookmarks)
- Many Plugins available (eg. authentication, authorization, client side validation, thumbnail, rss)
- Actively developed
- Good documentation
1 – Ajax and Javascript
With all the hype surrounding web II.0, any major PHP framework has to add some Javascript and Ajax support. Symfony gives you a few nice building blocks. Small example:
<?php echo form_remote_tag(array(
'url' => 'project/addReply',
'update' => 'replys',
'complete' => visual_effect('highlight', 'replys').
"Element.hide('addReply')",
'position' => 'bottom',
), 'id=addReply style=display:none;') ?>
<?php echo input_hidden_tag('id', $project->getId()) ?>
<?php echo textarea_tag('body') ?><br />
<?php echo submit_tag('submit') ?>
</form>
<?php echo link_to_function('Add a reply', visual_effect('toggle_appear', 'addReply')) ?>
This little snippit gives you an AJAX form, which submits its data to project/addReply (module/action). With a nice visual effect for appearance. Extremely fast to implement and extend. Have a look at my ajax comment form example.
Read More: Ajax in Symfony
2 – Instant admin interface: Advanced crud generation for admin interface
Useful for almost any type of website. Say you have a job listing website, run the command:
symfony propel-init-admin backend listing listings
and there you have your crud admin interface ready. Pretty, friendly, fully featured and without writing a single line of code.
But wait, what if I want to include feature X in the admin interface? Symfony uses a generator.yml configuration file which allows you to set filters and customize your admin interface. Most of the time this will more than fulfill your needs and you will easily create complete and functional backends.
See it happening: Generator Movie
3 – Nice Urls: The Routing System
Symfony uses a frontend controller, in which all requests are managed through a single frontend. This makes creating nice urls simpler than ever.
post:
url: /weblog/:title
param: { module: post, action: permalink }
list_of_posts:
url: /latest_posts
param: { module: post, action: list }
How does that compare to writing htaccess files?
If you for instance would want the url for member profiles on your site to be www.mysite.com/members/member-name you would simply use:
url: /members/:membername
param: { module: users, action: show }
The url indicates how you want the url to look and the param value tells Symfony where the code is located.
Read More: Links and the routing system
4 – Form Handling: Fillin, Validation and Creation
One of the areas where Symfony really shines is the handling of forms. The code for generating forms is clean and easy to understand and learn.
<?php echo select_tag('name', options_for_select(array(
'Steve' => 'Steve',
'Bob' => 'Bob',
'Albert' => 'Albert',
'Ian' => 'Ian',
'Buck' => 'Buck'
), 'Ian')) ?>
=> <select name="name" id="name">
<option value="Steve">Steve</option>
<option value="Bob">Bob</option>
<option value="Albert">Albert</option>
<option value="Ian" selected="selected">Ian</option>
<option value="Buck">Buck</option>
</select>
Furthermore validation and re-filling the form is done in a configuration file. This keeps your code and templates nice and clean. An example:fillin:
enabled: true
fields:
name:
required:
msg: The name field cannot be left blank
sfStringValidator:
min: 2
min_error: This name is too short (2 characters minimum)
max: 100
max_error: This name is too long. (100 characters maximum)
With some simple config lines you can take care of fillin and validation. For the skeptics, off course you can define your own validators. As far as I’ve experienced you can pretty much extend Symfony any way you like, with minimal effort. If you want client side validation as well you can opt to do so by installing one of the many plugins.
Read More: Forms in Symfony
5 – Debugging on Steroids
We all wish our code to run smoothly in the first try. However the only way to achieve this is to never try anything new. If we have to Debug, let it at least be fast. Symfony provides us with a few awesome tools. First one is the developer toolbar.
Showing you: 1. your application variables (useful for multiple development environments) 2. logs and messages (all the steps used for executing the page, perfect for debugging) 3. the number of queries and their sql 4. the size of the page 5. the load time throughout various points of the code.
If you do something wrong related to Symfony, it gives you a nice explanation of the problem, through it’s custom error display. Installing the famous Xdebug extension further increases the amount of information displayed.
Read More: Application Management Tools
All these little things together make developing with Symfony a joy. More goodness to come up in part two of this post.
(Watch out with installing Symfony though. It will take you anywhere between 30 seconds and two days. Depending on your experience with PEAR. There are some great install guides on the Symfony Wiki.)
Update:
Part 2 has been published: Ten Reasons why Symfony rocks – part 2



ruzz on symfony | Blog Archive » here here responded on 18 Aug 2007 at 9:51 pm #
[...] we need more talk like this. Ten reasons why Symfony rocks – Part 1 [...]
Nathaniel B responded on 18 Aug 2007 at 10:25 pm #
Great write-up, I’m looking foward to your second part that highlight’s symfony’s abilities!
Cheers :)
10 Gründe warum Symfony rockt - Ablage - blogged on responded on 19 Aug 2007 at 4:42 pm #
[...] Ten Reasons why Symfony Rocks bei Mellow Morning 19.08.2007 um 18:13 in Ablage von dave · RSS 2.0 feed. Schreibe ein Kommentar oder setze einen Trackback auf deine Seite. [...]
t8d blog » Blog Archiv » 10 Gründe, warum Symfony rockt responded on 20 Aug 2007 at 7:29 am #
[...] Schellenbach zeigt 10 gute Gründe, warum man sich das PHP Framework Symfony mal genauer ansehen [...]
rpsblog.com » A week of symfony #33 (13->19 August 2007) responded on 20 Aug 2007 at 9:34 pm #
[...] Ten reasons why Symfony rocks – Part 1 Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages. [...]
gillbates responded on 21 Aug 2007 at 7:44 am #
thanks for writing this. good writeup from someone who has spent time learning the framework
James responded on 23 Aug 2007 at 6:39 am #
Geweldig artikel, wanneer kunnen we deel 2 lezen ?
Ik ben benieuwd naar de overige mogelijkheden van dit framework.
Mellow Morning » Ten reasons why Symfony rocks - Part 2 responded on 08 Sep 2007 at 8:00 pm #
[...] you weren’t convinced by the first 5 reasons why Symfony rocks, you will certainly be [...]
Blog responded on 11 Sep 2007 at 10:16 pm #
Warum symfony rockt…
Für den Fall das einige Leute immer noch nicht begriffen haben warum symfony so rockt, hat Thierry Schellenbach die 10, seiner Meinung nach, wichtigsten Gründe aufgezählt. Und ich kann nur dazu sagen, der ja so Recht Ten reasons why Symfony rocks …
Mellow Morning » Quick Symfony trick - The remote_function workaround responded on 30 Sep 2007 at 12:15 pm #
[...] mentioned in previous posts, Ajax in Symfony is a very easy experience. However sometimes the pre-made functions don’t provide all the functionality you [...]
tschellenbach responded on 08 Oct 2007 at 7:44 pm #
Hi Thierry,
I was just reading your blog article about symfony handling AJAX forms (http://www.mellowmorning.com/2007/08/18/ten-reasons-why-symfony-rocks-part-1/)
Since I’m developing a small application with Symfony at the moment, I was trying to set up something similar like you did with your demo-guestbook (http://www.mellowmorning.com/symfony-examples/comment). Unfortunately, it didn’t work yet…
My question: Could you send me the action, that is handling the request being sent by the AJAX form? I think that could help me a lot with understanding how this works.
Thanks in advance and regards from Germany,
Matthias
tschellenbach responded on 08 Oct 2007 at 7:45 pm #
Hey Matthias,
Glad to see you are exploring Symfony.
I added some comments to the action to clarify.
Hope it helps :)
Note that there is some additional code in there, for added functionality from:
http://www.mellowmorning.com/2007/09/08/ten-reasons-why-symfony-rocks-part-2/
public function executeUpdate(){
//if not an ajax request send them a 404
if(!$this->getRequest()->isXmlHttpRequest()) $this->forward404();
$comment = new Comment;
$comment->setAuthor($this->getRequestParameter('author'));
$comment->setBody($this->getRequestParameter('body'));
$comment->save();
//set the comment variable for the template
$comments[] = $comment;
$this->comments = $comments;
//dealing with caching
$sf_root_cache_dir = sfConfig::get('sf_root_cache_dir');
$cache_dir = $sf_root_cache_dir.'/frontend/*/template/*/all';
sfToolkit::clearGlob($cache_dir.'/*/*/comment.cache');
sfToolkit::clearGlob($cache_dir.'/*/comment.cache');
}
Cheers,
Thierry
Simon responded on 12 Oct 2007 at 10:12 am #
Symfony’s certainly got some awesome points, I’m developing something using it at the moment for about 4 weeks now.
First off, I agree completely with the points above, but for those purists.. I have a few nags:
I am pretty annoyed about standards however. The form validation puts stray div’s with custom style=”display:none” If there has not been an error, which makes your code look ugly.
The Ajax helpers use “document.write” INLINE for writing Ajax updaters etc.. now thats just nasty – I really like my prototype to be nicely bundled, and chucked into a included file, with some nice prototype.behavior extensions to apply them to my elements (seamlessly).
It’ll be interesting to see I can get around the inbuilt form validation, and implement my own version too, thats what I’m battling with at the moment.
tschellenbach responded on 12 Oct 2007 at 10:20 am #
So far I really like Symfony’s architecture, it is all very extensible. Quite complicated, but very extensible.
Most of the time (so far for me, always) you can change the frameworks behavior, without any danger of creating future compatibility with updates.
links for 2007-10-16 | xanders blog responded on 16 Oct 2007 at 5:27 am #
[...] Mellow Morning » Ten reasons why Symfony rocks – Part 1 (tags: symfony php validation tts ajax web2.0) « links for 2007-10-12 [...]
What’s cooking at Tech-Recipes » Blog Archive » Happy birthday symfony responded on 20 Oct 2007 at 3:00 am #
[...] search was quickly and richly rewarded. I found lots of glowing references for the symfony framework. Symfony is so much more than what I was looking for, but [...]
Mellow Morning » Introducing a cross site ajax plugin for Prototype responded on 25 Oct 2007 at 9:00 pm #
[...] doing Ajax was my main reason to choose the prototype framework. Furthermore it is also included in the great Symfony framework. In Prototype Ajax requests are written like [...]
Mellow Morning » A new job! - but no Symfony responded on 20 Jan 2008 at 10:43 pm #
[...] done an absolutely amazing job. My opinion on the framework is best described by these blog posts Part1, Part2. However the current project we are working on has some special requirements. First of all [...]
Lawrence Krubner responded on 16 Jul 2008 at 9:34 pm #
Your link is broken:
“Update: part 2 is here.”
I clicked on that, at the top of your post, and it took me no where.
tschellenbach responded on 17 Jul 2008 at 8:20 am #
Fixed
Mellow Morning » Django vs Symfony responded on 27 Aug 2008 at 7:52 pm #
[...] you can see from the posts (one, two) I’ve always been a large Symfony fan. Symfony is really great, but my current favourite [...]
Daily Digest for 2008-08-28 | Pedro Trindade responded on 29 Aug 2008 at 7:55 am #
[...] Mellow Morning » Ten reasons why Symfony rocks – Part 1 [...]
Qoseladm responded on 13 Dec 2010 at 7:17 pm #
Hello good day subchamber pthc 08530 hussyfan pthc 781362 lolita pthc forums %PPP jenny dog pthc %[ pthc web 8[[ dorki ranchi pthc :-[[ womb8t pthc 96284 pthc nude galleries 929 pthc like horse ywtjcj pthc bbs message board >:[[[
Utxculrj responded on 13 Dec 2010 at 7:17 pm #
very best job pthc photo naked 0418 pthc cp sandra bbs qyiwnk kidz pthc snubrq pthc movie buy
231 bbs jap repe pthc 4774 pthc r ygold ranchi :-[[[ pthc image board jp nbo pthc bbs board 5421 fucked pthc caelan pthc movie free =-))
Gustavo the keylogger responded on 07 Jan 2011 at 6:13 pm #
Symfony is great !, i don’t know why i didn’t used it before. But learning takes weeks
Cvovpguq responded on 17 Jan 2011 at 8:53 pm #
Excellent work, Nice Design preteen upskirt
lfomnr nudist preteen
8[[ nude nymphets
412 preteen art models
fibm preteen cuties
aqu russian nymphet
5216 preteen nude girls
smkp preteen erotica
37192 young nymphets
7417 preteen ass
88961 preteen pussy pics
bklm preteen photos
wncm preteen modles
oins nymphet
=-DD little nymphets
977 hot preteens
8O preteen tits
159 preteen sluts
63117 ukrainian nymphets
6176 naked preteen boys
pno
Sdqemupo responded on 03 Mar 2011 at 4:41 pm #
Best Site good looking Lolita Dresses
6514 Lolita Nude Pics
>:OOO Lolita Photos
1043 Lolita Pay Sites
969480 All Lolita Site Nude
vfzzlw Preteen Lolita Pussy
>:DD Gothic Lolita
gnuv Lolita Biz
>:-P All Lolita Site
=((( Lolita Ls Preview
pklt The All Lolita Site Nude
=-]]] Uncensored Lolita Toplist
8250 Lesbian Lolita
mgmhed Lolita World
834 Lolita Angels
3607 Lolita Cumshots
:O Little Lolita Porn
xpktf Webring All Lolita Site
680829 Lolita Nudist
6408 Lolita Teens
lgosa
frenky responded on 07 May 2011 at 5:49 pm #
FKU9mT http://gdjI3b7VaWpU1m0dGpvjRrcu9Fk.com
Nzjojofk responded on 14 Jun 2011 at 8:56 pm #
magic story very thanks young spread legs lolit =-( nn loli pre model >:( videos chochos lolitas preteens qks ls loli gallery google =-D 12 loli art pic 468261 legal teen lolitas nude xiv prelolitas models sexy galleries >:DD all lolita porn gallery 3917 lolitas 12 years models jlnju jp photo bbs loli 8[[[ young pubescent lolita fellatio 8-DDD very young lollita vagina =-( illegal preteen lolita porn etltiz www lolita model org 2332 15 yo lolis ero =-) lolita virgins lolita toplist %[ sweet angels calendar lolita tpqxrz 5.y.o lolita nude pic :[[ lolita young russian girl anpn ls sites lolita news koi
Hplyjbqu responded on 15 Jun 2011 at 6:22 pm #
Cool site goodluck :) Nude Art Lolitas Magazine
jjb Underage Nude Lolita Pics
229 Top Lolitas Nude Pics
ylhen Lollita Bbs Tiny Model
599643 10yr Old Lolita Porn
292 Little Lolita Art Tgp
041 Japan Image Board Loli
ccmvv Lolita Nude Art Games
%-OO Preteen Lolita Girls Tgp
2151 Nude Underage Lolitas Gallery
vodf Sexy Very Young Lolitas
596 Lolita Teens Just Young
>:)) Nubile Lollita Nipple Pics
8-D Sexy Preteen Lolita Pics
8) Lolita Boy Free Pics
gmsud Little Lolita Pantie Models
tsabt Custom Gothic Lolita Corsets
:-OOO Beauties Model Teens Lolita
:( Preeten Lolita Pics Free
307 Lolitas Teen Nude Art
8]
Oeyooyrb responded on 28 Jun 2011 at 5:39 pm #
Thanks funny site loli suck daddy 01883 bbs rs replacement centers 161015 bbs teen nudist %P desperado teru bbs :-OO rope bbs 045574 bbs phone list 56932 khandelwal vidya mandir,address ranchi jharkhand kecw frind bbs :-PPP young girl nude photos bbs 33104 double loli suckers 4857 child thong models 160 free asian young underage slutty porn videos gtwc kiki loli sgnzuv teen bbs models >:DD kikis bbs fpqqn bbs tgp young psuqk tyflas bbs %]] bbs ls magazine bd sister dpy underage sex sites gsc michelle amanda babin la models zvumq little black girl 2502 ls land magazine >:-(( healthline search results for dark bbs fpkr pink lolis bbs kfdgqw preten nude bbs pzbdn loli jaguar =(( thecache bbs fciy young cute nn model >:-) sun toplist 685 bbs loli rori cokz
Nzwrabnj responded on 01 Aug 2011 at 5:39 pm #
I’m on business youngleaf com 8PP youngest thai sex %PPP cute hentai sex >:-[[ jap bikini idol thczp non nude submitted 8233 deflowering young teens tpfvlz tiny young things 611 young fucking grils 979883 munnabhai ranchi sxrzuj britiny spears pussy 271466 kids fisting uozo audition bikini free iqeepv svens bbs gateway
174 young asian hoe lqgqd feedom forum bbs =]] cute hot teens weyym adult nightime chills %OOO youngerbabys 9364 bikini marciano :-DD bikini non nudes eyay
Irykylna responded on 02 Aug 2011 at 11:44 pm #
I’m from England Preteen Chat
avjyea Nn Preteens
>:]]] Preteen Models Nude
ujy Preteen Nude Girls
=OO Preteen Angels
xozfr Preteen Cuties
xcc Preteen Nude Pics
>:-DD Art Nude Preteen Models
=-)) Russian Preteen Models
308159 Non Nude Preteens
:P Preteen Pictures
qthtv Preteen Nonude
=-P Preteen Nudity
hfst Preteen Sex Videos
kdbh Preteen Naturist
:[[ Preteen Girls Nude
=-) Preteen Nn Models
:O Preteen Boy
:-) Preteen Art Models
>:[ Preteen Portal
580
Znzzwpdk responded on 07 Aug 2011 at 3:03 am #
Have you seen any good films recently? Underage Sex Porn Lolita
tbfv Young Kiddy Lolita Tgp
=O Childrens Nude Models Lolita
712 Preteen Lolita Fashion Models
yhoq Little Lolita Incest Pictures
=-OOO Top Sites Preteen Lolas
rdp Little Lolas Non Nude
8[[ Nudist Lolitas Nude Preteens
54650 Young Lolita Nude Toplist
23881 Hot Tiny Hot Lolita
ddj Pre Teen Littel Lola
=D Child Big Modeling Lolita
18880 Illegal Search Lolita Russia
awaju Top Kds Lolita Sites
ktpky Naked Lolita Kids Picture
33708 Little Forbidden Russian Lolitas
=DDD Lolitas Preeteens Tiny Young
=-( Erotic Child Lolita Photos
418814 Images Teen Lolita Russian
=((( Dreamwiz Child Lolita Photos
>:-OO
Qjedshyi responded on 07 Aug 2011 at 9:42 pm #
Enter your PIN Pedo Cartoons
87863 Pedo Loli
jui Pedo Stories
:]] Pedo Child
3210 Pedo
>:[[ Pedo Toplist
8297 Bbs Lola
3135 Pedo Bbs
%O Pedo Kids Video
=]]] Pedo Love
6319 Pedo Pics
wlx Pedo Porn
04850 Pedo Bear
ugy Pedo Girls
99708 Pedo Sex
pixpml Top List Pedo Sites
tbwpbg Pedo Star
:-DDD Pedo Sites
:-)) Pedo Sex Stories
8802 Pedo Aficionados
4327
Uccpbtyw responded on 11 Aug 2011 at 3:53 am #
Directory enquiries Teen Lolita
iansbc Dark Lolita
136 Lolita Girls
3729 Lolitas Nude
mqklb Lolita Galleries
:P Lolita Links
mdwq Preteen Lolita Models
2084 Lolita Top List
=-PPP Lolita Cp
0189 Lolita Topsites
016 Great Lolita Bbs
361032 Top 100 Lolita Sites
2736 Lolita Gallery
453 Lolita Sex Stories
272778 Bbs Lolita
:-]]] Lolita Teen
8779 Index Lolita
76685 Best Lolita Sites
>:-((( Off Lolita
8P Lolitas Toplist
:]
Ncebgodz responded on 11 Aug 2011 at 6:30 pm #
Whereabouts in are you from? Underage Xxx
:]]] Underage Fucking
1452 Preteen Naked Underage Lolita Toplist Top 100
>:] Free Underage Lolita Porn
ygwieq Underage Tube
23260 Underage Lolita Galleries
mqmlj Underage Tgp
cizc Girls Underage Naked Pics
167 Underage Incest Pictures
8-((( Underage Art
:DDD Underage Incest Stories
>:-[ Underage Naked Girls
8-) Underage Teen Pics
hyig Lolita Underage
%-PPP Illegal Underage Porn
=-P Underage Lolita Porn
xxan Underage Cp
kmr Naked Underage
148 Underage Girls Naked
:-[[[ Lolita Underage Nude
8-(((
Sjnnuhxx responded on 13 Aug 2011 at 5:54 am #
Sorry, I’m busy at the moment emma starr sex red tube
pbz blue tube red head
ndii red wings on you tube
lhqz red tube nude dancing
53957 red tube costumes
ayxgev red tube first fuck
019 red tube mature women kissing
=-]]] red tube porn beach
=(( red tube male
6849 red tube les
aeqm red tube camping three some
ostcsi free porn clips red tube
351 monster dicks red tube
896 red tube lesbians fisting
:-PP red tube milf linda
83397 red tube babes poolside
>:DD she sucks me dry red tube
meifnm whores on red tube
520 red tube latin girls alone
yqjtvp breast bondage red tube
8-))) red tube sucker
956 muture young red tube
ptcbs sexy college girls red tube
17077 red tube brunnettes
08779 red tube bondage videos
8] chrissy moran on red tube
>:-]]] milf nurse red tube
015088 sister in the shower red tube
=P red tube teen lesbians fist
>:OOO hot house wifes red tube
:))
Lqvnftkw responded on 06 Sep 2011 at 11:10 pm #
Where do you study? lolita nymphets nude
%-]]
Kdwbtfon responded on 07 Sep 2011 at 10:56 pm #
Lost credit card ls magazine bbs
mlybkc
Damvitea responded on 08 Sep 2011 at 2:50 am #
Enter your PIN pedo story sites
40989
Xflhrhez responded on 08 Sep 2011 at 6:48 am #
A company car junior models
430
Lqnymgdv responded on 08 Sep 2011 at 3:18 pm #
A pension scheme cp lolita
8[[[
Hkuwdzrn responded on 19 Sep 2011 at 12:34 pm #
I’d like to change some money Cp Hussyfan
98325
Sfwgysio responded on 23 Sep 2011 at 6:37 pm #
What’s the last date I can post this to to arrive in time for Christmas? Preteen Art
8O
Lkrepael responded on 23 Sep 2011 at 6:38 pm #
Go travelling Preteen Nude Art
6262
Damolwrg responded on 25 Sep 2011 at 12:29 am #
I’m self-employed Ebony Exotic Models
=-(((
Oswcndvm responded on 11 Nov 2011 at 12:20 am #
I hate shopping Nn Model Sierra
aisr
Iuarkgnj responded on 03 May 2012 at 5:19 am #
I came here to work http://ylyqymogufid.de.tl bbs lingerie model Good vid here, but this girl turns me off. Her implants are nasty. Implants are no good if they’re not done right.
Yqivipug responded on 03 May 2012 at 6:24 pm #
I’m interested in this position http://obirooolu.de.tl underground child bbs Krystal Summers is a porn star. She had a nerd as her husband on please fuck my wife. She has a website. BUT SHE IS HOT
Dkxshpka responded on 06 May 2012 at 6:26 pm #
I’m on holiday http://upybecaresiby.de.tl forum preteen naked I want a wife just like this !!! She is absolutely beautiful and just the type of partner I want it life…
Kbhakark responded on 06 May 2012 at 6:51 pm #
I’m not sure http://peuhoymad.de.tl youngest model videos lol i saw another porno where this dude was in it and he said the same thing whilst ejaculating,’OOOOOO DROPPING LOADS ALL OVER THE ROOM’…..Lmao wdf does that mean?
Zpdlkiaj responded on 07 May 2012 at 2:31 am #
I’m doing a masters in law http://aekociioj.de.tl little sexmodel Oh yeah Micah is so fucking sexy and so damn good looking with a hott ass body…like everything she does what a hott woman…
Rmbozxeg responded on 07 May 2012 at 5:32 pm #
I’m sorry, I didn’t catch your name http://tyyololy.de.tl preteen underage galleries She had a mouth full of sweet cum, then the camera cut away. I sure hope she did the right thing and swallowed.