Introducing YippieMove '09. Easy email transfers. Now open for all destinations.

Picture of The Definitive Guide to symfony.Symfony is a PHP web development framework, similar to Ruby on Rails. The framework is currently gaining in popularity; a few months ago it was announced that it is used by Yahoo! Bookmarks, for instance. Recently, version 1.0 of symfony was released. A print manual, “The Definitive Guide to symfony” by François Zaninotto and Fabien Potencier, was prepared in conjunction with this major update of symfony.

As the title suggests, the Definitive Guide to symfony is a guide book. Every chapter explores a certain component or part of symfony, ordered in such a manner that someone who hasn’t touched symfony before can easily get started. The book is not a tutorial; even that the chapters are sensibly ordered, the book does not take the reader through the process of developing an application.

The sections of the guide are,

  1. The Basics: An introduction to symfony, who made it and why, and a primer to the underlying technologies used by symfony including PHP itself. Later chapters in the first part delve into an overview of how symfony works and how to set up an application in the framework.
  2. The Core Architecture: This part of the book is essentially a description of the MVC pattern and how it is employed in symfony. The chapters talk about how the Control, View and Model layers work in symfony.
  3. Special Features: If the previous parts are about the foundation of symfony, the Special Features part of the book is really about the bells and whistles of the framework. The routing system, the form helpers, Ajax, caching and internationalization are described here.
  4. Development Tools: A description of the tools and mechanisms in symfony used during the development tools, just like the name would imply. Generators, unit testing and other important tools are described here. Towards the end there is an oddly placed chapter about extending symfony.
  5. Becoming a symfony Expert: This is a very interesting section which gets into performance optimization for symfony. The authors pool some very valuable practical experience about deploying symfony applications into this part of the book.

The book places almost no requirements on the reader. Obviously you will need to know PHP 5, but apart from that the book carefully introduces almost every concept used in the framework. At the same time I don’t think that a more experienced programmer would find the hand-holding excessive – the 450 or so pages went by quickly when I read the book, and I have worked with symfony before.

The book also features a good selection of sample code and examples. This is in line with the general pragmatic feeling of the book. There is no key concept left without an illustrative code sample. Anyone who has worked with symfony and its developers before will recognize this. The official website is absolutely brimming over with code samples, and Mr. Zaninotto in fact even wrote ‘snipeet’, a code snippet repository. The book is right in line with this demonstrate-by-code philosophy.

The book has some shortcomings. The chapter about Generators feels incomplete for one. Ostensibly the chapter is about the automatic generation of code, called scaffolding, that is a common feature for many modern web development frameworks. This kind of generation makes it faster to develop web applications since it creates a foundation (hence the term scaffolding) for building the web application. But the Generators chapter is really hijacked by the automatic admin generation feature of symfony. While this is a very powerful and impressive feature, the very strong focus on this feature may leave the reader wondering about the ordinary, non admin, scaffolding functionality. For example, it is not at all clear how to customize what generated scaffolding should look like. With such a lengthy description about how to customize the generation of the admin interface, the omission of a corresponding general section is conspicuous.

(For the record, this is how to theme or customize the generated scaffolding:

  1. Copy the default theme from

    $sf_symfony_data_dir/generator/sfPropelCrud/default/theme

    to

    data/generator/sfPropelCrud/default/theme

  2. Edit the files in data/generator/sfPropelCrud/default/theme/templates as you would with an admin template.
  3. Generate like usual: symfony propel-generate-crud <app> <module> <base>.

The generated code will be built to specification.)

Another shortcoming of the book is that there are a few instances of bugs in the provided source code. It might have been useful if the authors had taken a day to test-run their code. For example, in the database section, page 156, the following sample databases.yml listing can be found:


all:
  propel:
    class:                sfPropelDatabase
    param:
[...]
      encoding:           utf-8     # Default charset [...]
[...]

When I tested this code I got an error message: Unknown character set: 'utf'. Turns out that “utf-8″ is not the correct identifier – “utf8″ is correct.

These shortcomings are minor though. A few typos are to be expected, and with so much to cover omissions may accidentally be made. All in all the book is a friendly and pragmatic one. The material is described in a light and fluffy way – there is no ‘academic’ dead weight or terse theoretical descriptions, but rather a hands on description about what symfony programming is like. The book can be used both as a primer and as a reference for a person who is not yet a symfony expert.

If you want to know more about the book, you can actually finds its whole contents online. At the time of this writing, the online edition is available at The Definitive Guide to symfony. This is very generous and a great aid when you want to quickly search for something. Curiously enough Apress, the publisher of the book, has a full page ad for an eBook version in the print edition. They charge $10 for this pleasure, which is a bit odd.

Update 1: The original article credited Mr. Potencier with the Snippeet application. Snippeet was in fact written by Mr. Zaninotto. I apologize for the mistake.
Update 2: Jason Gilmore, the book’s editor, wrote to let us know that Apress sells the $10 ebook as an additional means to support GFDL work. Take a look at the comments section below for the full clarification.

Be Sociable, Share!
Author: Tags: , ,

Trackbacks/Pingbacks

  1. Playing With Wire » Extreme Web Development - 60 seconds, 4 browsers, 1 machine
  2. What’s cooking at Tech-Recipes » Blog Archive » Happy birthday symfony

9 Comments

  1. Hi, this is François, one of the the book’s authors. I wanted to thank you for this review, and to write a few notes about your remarks.

    The scaffolding customization wasn’t developed at all in the book because when you start needing a custom theme, you’re not in the process of building a scaffolding (i.e. something that will serve as a base for future adaptations), but rather making a new generator. We explained how to develop a custom generator at the end of the chapter, and we hoped that it could help people like you, who need to use the provided classes for purposes that we didn’t plan in the first place, to customize and reuse them. But you’re right on saying that there’s never enough documentation; unfortunately we had to make choices about what had to be in the book and what had to be left aside – the number of pages is not unlimited. With more than 30 pages dedicated to the admin generator, there was not much room left to the scaffolding…

    About the bugs in the source code, be assured that we tested all the examples provided. But despite the numerous rereadings (and maybe because of it), there are always typos left in the final book. That’s also one of the greatest advantages of having the book available online for free: we can keep on correcting it even after the paper book release, and provide an accurate and up-to-date documentation. If the book sells well, be assured that the second edition will correct all the bugs we’ve spotted so far.

    One last remark: I was the one writing the snipeet application, but I know that people often see Fabien and I as the same person…

    Thanks again for your comments, and welcome to the symfony community!

  2. Thank you for your feedback on the review.

    Regarding the Generators chapter: I was repeatedly finding myself taking the default table based scaffolding and rewriting it to use labels and divs. So when I came into the Generators chapter I was hopeful to find some way to make this change once and for all. But I certainly understand that space is limited. Ironically enough I had a longer explanation about the Generators bit in a first draft of the review, and I cut it out to keep the review below 1,000 words.

    Either way, thank you for a well written and easy to read book! I do wish more technical authors were as down to Earth as you and Mr. Potencier.

  3. Hi Alexander,

    Thank you for the kind review. As the book’s editor, and Apress’ Open Source Editorial Director, I wanted to offer some thoughts regarding our sale of the e-book despite it also being available under the GFDL. As you might imagine, both the authors and Apress poured considerable time and resources into the book, and clearly note the book’s availability under the GFDL. Accordingly, should readers be interested in supporting future works of this nature, we invite them to purchase either the print or electronic version (or both). There’s certainly nothing odd about it; it’s just another way to support both authors and publishers who choose to license their work under open source licenses.

    Hope this helps to clarify our intentions.

    Thank you,
    Jason

  4. rob ganly says:

    I found this book an excellent resource as someone who needed to learn and use symfony in a very short space of time. It provides the reader with a solid understanding of the framework on which to build.

    The fact that it doesn’t offer any example application tutorials is fine as it encourages you to get involved with the online community to seek examples, ask questions and learn more. No doubt subsequent books on the symfony framework will offer complete application tutorials and walk-throughs.

    You summed it up well with:

    “The book can be used both as a primer and as a reference for a person who is not yet a symfony expert”.

    Rob Ganly

  5. rihad says:

    I’ve been struggling with many of Symfony’s bugs and shortcomings since May this year. What can I say… In the strive for popularity, the Symfony guys wrote an excellent book on alpha quality software which Symfony really is. I’m really pissed off… now I can’t get rid of it because I have to finish my current project by September. True, there are no good free alternatives to Symfony written in PHP, but there’s NO excuse to be lying in the book about some features which really aren’t supported or are buggy…

  6. Rihad,

    I’m sorry to hear that you have experienced roadblocks. I do believe your situation is not typical however as I’ve had a great deal of success with symfony both within WireLoad and outside of it. As with every software project, there’s going to be a time when you have to go off the beaten path and figure things out that haven’t been fully documented or developed yet, but none the less, every key feature that is needed for a modern web application is right there and easy to use in symfony.

    I hope that whatever ails your software project can be cleared up on time. Good luck.

  7. rob ganly says:

    rihad, i think your argument would be more convincing if you’d refrain from swearing and give a couple of examples to back up your accusation of ‘lying’.

    also, to be honest i can’t imagine these guys lying about much… they’re talented people and seem to have integrity.

    your turn…


© 2006-2009 WireLoad, LLC.
Logo photo by William Picard. Theme based on BlueMod © 2005 - 2009 FrederikM.de, based on blueblog_DE by Oliver Wunder.