Playing With Wire » symfony http://www.playingwithwire.com The Internet Startup Blog Wed, 20 Jul 2011 18:45:29 +0000 en-US hourly 1 Installing symfony on OS X Leopard http://www.playingwithwire.com/2007/10/installing-symfony-on-os-x-leopard/ http://www.playingwithwire.com/2007/10/installing-symfony-on-os-x-leopard/#comments Thu, 01 Nov 2007 04:59:18 +0000 http://www.playingwithwire.com/2007/10/installing-symfony-on-os-x-leopard/ Just in case anyone runs into trouble with this, I just want to describe the steps for installing the symfony framework on an OS X 10.5 (Leopard) machine.

The good news is that Leopard comes with PHP 5 built in. The bad news is that PEAR is not included, which is needed to install symfony in the most convenient way.

My first attempt to remedy the situation was to run the darwin ports package manager to install pear:

# port install pear-base

Unfortunately there were two problems. First of all, the version of pear that comes with darwin ports does not use the OS X version of PHP by default, but rather looks for the PHP darwin port. This was easily remedied by adding export PHP_PEAR_PHP_BIN=`which php` to /etc/profile but unfortunately that’s not enough. The second problem is that a few files seems to be missing in the darwin port of PEAR and you’ll get the following error when you try to install symfony:


PEAR_Downloader::require_once(Structures/Graph.php): failed to open stream: No such file or directory in Downloader.php on line 1230

Indeed, even running pear install Structures_Graph results in this error message.

The Solution

This blog suggested go-pear.php as an alternative way to install PEAR on the Mac and it does work. So with no further ado, this is how to install symfony on Leopard:

sudo su -
curl http://pear.php.net/go-pear > go-pear.php
php -q go-pear.php

pear channel-discover pear.symfony-project.com
pear install symfony/symfony

Good luck with your Leopard powered symfony hacking.

]]>
http://www.playingwithwire.com/2007/10/installing-symfony-on-os-x-leopard/feed/ 6
Review of The Definitive Guide to symfony http://www.playingwithwire.com/2007/02/review-of-the-definitive-guide-to-symfony/ http://www.playingwithwire.com/2007/02/review-of-the-definitive-guide-to-symfony/#comments Tue, 27 Feb 2007 06:33:44 +0000 http://www.playingwithwire.com/2007/02/review-of-the-definitive-guide-to-symfony/ 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.

]]>
http://www.playingwithwire.com/2007/02/review-of-the-definitive-guide-to-symfony/feed/ 9