You are browsing the archive for Symfony.

The state of Symfony2 support in IDEs

4. November 2011 in IDE, Symfony, Symfony2

I have developed a lot with Symfony2 in the last months. During this time I switched my development environment a lot too find the tools that fit my workflow as good as possible. Now we have a stable release of Symfony2 available it is time to take a look at the Symfony2-Support of my favorite PHP-IDEs.


Years ago Eclipse was my main IDE for PHP development. I switched to Netbeans with the version 6.5 because it was faster, more stable and got symfony 1 support in one of the 6.x versions. I never looked back. It is fast, stable and has a lot of cool features like PHPUnit-Support or the awesome code-formatter. The symfony 1 support is good, I loved to use the command-line runner and the switching between views and controllers. The PHP support is exellent and supports PHP 5.3. But there is no special support for Symfony2 projects available at the moment. I started a feature request some month ago but there is nothing new here. For a long time there was no Twig-Support either. This can be solved by installing a Plugin but it is sometime a bit buggy and unstable.


I felt in love with PHPStorm when it was released in Version 1. It is even faster than Netbeans and has all features you need. Debugging-Support is pretty good, PHPUnit is integrated, Good Code-Formatting is available, PHP 5.3 is supported. The lookup of classes and files is fast and convinient. Twig is supported out of the box in the current stable version. All in all it is a great IDE to develop PHP-Projects. There is no special Symfony2 support at the moment. For me the great JavaScript- and CSS-Support is a big bonus, as I develop a lot of code with backbone.js and other JS-Stuff these days. PHPStorm isn’t free but available for reasonable prices. I never regret that I bought a license.


Honestly I was surprised when I checked back the PHP-/Symfony2 support of Eclipse. Two month ago I started to recheck the option to switch back to Eclipse. I was pretty surprised that there are some nice features for Symfony2 developers waiting to be discovered in Eclipse. With some additional plugins you will get a really good Symfony2-IDE. I will write a blog-post about how to setup this as soon as possible (update. Here it is: “How to build a great Eclipse-Environment for Symfony2-Development“). The highlight is definetly the Symfony2 Eclipse-Plugin. It enhance Eclipse to the most advanced Symfony2 features so far. Here are some of them:

  • Autocomplete of route-names in Twig-Templates
  • Code-Assist of Template-paths
  • Code-Assist of Container-Services
  • Annotation-Support
  • Code-Assist for translations

I still don’t like the IDE itself. It takes lang to get used to it. You have to install a lot of plugins to ge a good feature set. Most of the time you will end in a plugin hell where some plugins only work with Eclipse version x another only with version y. In the end I always had more than one Eclipse-Installations (For PHP-Development, for Java-Development, for Flex-Development…). The PHP Support in general is good but the development is done pretty much out of the view of the community.


As I blogged some time ago, PHPEdit is a capable PHP IDE. It has the most advaned symfony 1 support of any IDE on the market, but this is limited on symfony 1. There was a survey some days ago about what support for Symfony2 is needed, so the makers of PHPEdit started to work on it but there is nothing ready at the moment. Even Twig is not supported at the moment. As I’m using MAC OSX for private projects and Windows at work I need an IDE that supports both platforms. PHPEdit though is only available for Windows. PHPEdit isn’t free but the pricing is ok for what you will get.


There are other alternatives too. Some do not use fullfledged IDEs for developing. There are some really cool editors out there. I’m a long-time-user of Textmate but the development nearly stopped and the development of the Version 2 is promised for years now. It is only available on MAC OSX. The best multi-platform alternatives I found are Sublime Text 2 and redcar. Both are really cool. I like Sublime Text 2 most. As TextMate it can enhanced via Bundles, it is small and lightweight.

Lessons learned from a Symfony2 – Training session – Part 2

9. June 2011 in General, Symfony, Symfony2, workshop

Two months ago I blogged about my experiences of giving a Symfony2 training course with the PR7 release of Symfony2. The last three days I gave another in-depth Symfony2 training course, this time using beta3 / beta4. It was interessting to see how much Symfony2 has evolved over the last two month. There were improvements at every part of the Framework and the current betas made a really solid impression.

The things the attendees loved:

  • The flexibility of Symfony. It seems that is nothing you can’t do with Symfony2
  • The annotation way of developing. Having the configuration metadata of Entities and Controllers all in one place (the DocBlock of the method).
  • The maturity of the underlying concepts. You can see that all concepts are really well-thought. I wasn’t able to count the amounts of “brilliant” shouts of the attendees in these three days but there were lots of them.
  • Twig! Everybody liked Twig. Most loved: The inheritance possibility of the templates
  • Assetic. This is one of the killer features of Symfony. Assetic is really great and powerful. We faced some problems with beta3 on windows with YUICompressor. After an update to beta4 some of them seems to be fixed, others remained.
  • Doctrine: Symfony1-Users like how lightweighted Doctrine2 is. New-time users love Doctrine for the features, abstraction and Query-Language.
  • Unit-Testing: Using PHPUnit is feeling really good. The WebTestCase is a easy way to test controllers and pages.

There are still some glitches with Symfony2 that brings up

  • Long-Time Symfony1 user are missing the magic sometimes. There is a bit irritation sometimes that there is that many configuration work.
  • Because Symfony2 is moving that fast, there is the problem that some interessting Third-Party-Bundles can’t keep up with all the changes. This is a problem until we have a stable release.
  • The last betas and PRs changed a lot of syntax (take annotations for example). All these changes made sense but the problem is that there are tons of tutorials in the web that use the old ways. That is not a Symfony2 problem at all but brings up a lot of questions.
  • Documentation: The official Symfony-Documentation is getting better and better. Ryan Weaver and the others are doing a brilliant Job there, the problem is that everything that is not in the core has only little, outdated or nearly no documentation at all. Take the Assetic usage in Symfony2 for example, or the FrameworkExtraBundle. It is sometimes difficult to find the right place to start your search for information. For Symfony2-beginners it’s a challenging problem.
  • Symfony1-Users are missing the out-of-the-box behaviours of Doctrine1. Sure you can install them using the DoctrineExtraBundle but we were not able to use this Bundle with beta3.

After three days packed with Symfony2 and Doctrine-Stuff I have a very positive feeling that we are getting close to a very stable and good release of 2.0. It is pretty amazing how much more flexibility new version brings and lightweighted I feels.

As always I’m looking forward to the next Symfony2 training session.

Netbeans-Codetemplates for Symfony2

14. April 2011 in IDE, Symfony, Symfony2

As I’m working with Netbeans when developing Symfony2-Applications I created some Code Templates and Shortcuts to work more effective with Netbeans and Symfony2. If you are interessted you can download the Settingsfile and import it to your Netbeans installation. There is a Symfony 1.x and Symfony2 version available.

You can get it here:

If you miss a template just send me feedback

Lessons learned from a Symfony2 – Training session

11. April 2011 in Symfony, Symfony2, workshop

I have given my first Symfony2 training session last week. It was a bit short (two-days) but I was able to cover the basic parts of Symfony2. As I have given a lot of symfony 1 trainings in the last three years I was pretty excited how this session will work out. Everything was new, the slides, the samples and of course the framework ;) Here are some facts I learned in this two days:

The good

  1. ASP- and Java-Users love Symfony2 :) Depepency Injection, POPOs, Entity Manager. All these concepts they know can be easily used with PHP.
  2. The new WebTestCase possibilities are incredible. Everyone liked the concept of using BrowserKit and Crawler to test simple webpages. The Usage of PHPUnit instead of
  3. Twig got some positive feedback too. Some didn’t really see the positive effects in using Twig instead of PHP on first sight but after some samples a a quick glance at the possibilities of the included filters and functions most of the attendess were convinced.
  4. Doctrine2 is fast and easy to use. Java-/Hibernate-Geeks had an easy start here because of the familarity of the API
  5. Veteran-PHP programmers without framework experience liked the possibility of MVC, environments etc.
  6. The new security subframework got some very positiv feedback too. Seems a good solution for most of the people

The bad

  1. Lack of documentation at the time of training. This is obvious and predictable. The training was done with PR9 and PR10 of Symfony2. Some of the documentation is pretty good at the moment wheras some is up to none existant or useless. A configuration reference was mostly missed. There are a lot of configuration parameters buried in the depth of Symfony and it feels like no one except of the core member are know how to use them (take a look at this for example: Stackoverflow). The Form-Framework is difficult to use at the moment because of the lacking documentation
  2. Compared with symfony 1 I saw that it is more difficult to get the attendees to a point of initial understanding how a Symfony application is build and working. This is because of the lack of Convention over configuration. At the moment I’m feeling the Configuration over Convention difficult to explain.
  3. The possibility of using different ways of configuration was kind of confusing to some of the attendees. When should I use YAML, XML or annotations? Difficult to get a common understanding on this. This was even worse under the configuration possibilities are not proper documented. Doctrine is a good example here. The Annotations are described in detail but the YAML not. I’m not sure how this will work out for large development teams when some will start to use YAML others PHP…
  4. Best-Practises are missed too. This is also understandable cause ther is no stable version but I think this is something that will take some time (probably until 2.1 or even 2.2). The biggest problem: Where to put the code? Especially database oriented code.

The flexibilty of Symfony2 is incredible but I have learned the last days that this is a high hurdle to take for a lot of developers. Compared with symfony 1 I think the lack of best practises and convention over configuration is the most time consuming part of getting productive with Symfony2. The new possibilities and features of Symfony2 are awesome and it is interessting to see how good some of the existing Bundles already are.

I have two more Symfony2 trainings coming in the next months. Im excited to how Symfony2 will evolve over the time.


First Sourcecode of TimeHive online

3. February 2011 in Symfony, TimeHive

I have been workign on a new open source project in the my sparetime of the last few weeks. TimeHive is a project timetracking solution written in Symfony. The sourcecode can be found at GitHub . At the moment there is no dedicated webpage for TimeHive, but I will setup one in the next few days. The installation has to be done manually at the moment (See README file).

Here are some teaser screenshots :)


Take a look at it. I appreciate every feedback (bug, patches, ideas…)


Some seats free for the upcoming german symfony training

25. May 2010 in Symfony, workshop

There are some seats free for my upcoming german symfony training session ( This training takes place mid-june (16-18th June) in a training center in Heilbronn.

Es sind noch ein paar Plätze für meine kommende offene Symfony-Schulung verfügbar ( Diese findet am 16. bis 18. Juni in einem Trainingszentrum in Heilbronn statt.

sfAmfPlugin 1.5.0 released

11. January 2010 in AMF, Flex, Symfony

Hi all,

I have just released the version 1.5.0 of the sfAmfPlugin.You can get it from here.

The new version brings some fixes and new features. Most noteably:

  • Updated version of SabreAMF inlcuded (latest development version)
  • Symfony 1.3 and 1.4 Support
  • First version of a AMF Service Browser (thanks to Benoît Gouchet)

The plan for the next version shows improvements for Class Mapping, VO and Caching. And I promise to create a better documentation for it…

Copy&Paste Detector Task for Phing

29. September 2009 in Continuous Integration, General, Phing, Symfony


I use the Hudson Continuous Integration system to build my Symfony projects (will write a blog series about this in the next few days). For that I created a new task  for the Phing build system. Sebastian Bergamann wrote a Copy&Paste Detector for PHP some time ago (PHPCPD). This small tool scans PHP sourcecode for duplications. You can use the Task in a Phing build file as shown in the following sample:

<phpcpd haltonerror="false">

  <fileset dir="${builddir}" id="filestocpd">

    <include name="apps/**/*.php" />

    <include name="lib/de/**/*.php" />

    <include name="lib/task/**/*.php" />

    <include name="lib/services/**/*.php" />

    <include name="lib/form/**/*.php" />

    <include name="lib/model/**/*.php" />


  <formatter type="pmd" outfile="reports/pmd-cpd.xml"/>


The CPD task is incorporatated in the current Phing trunk. If you want to use it you need to checkout the Version2.4.0 RC at the moment. The PEAR Installer version doesn’t contain the Task at the moment.

Maybe this is useful for you too. Stay tuned for more informations on Symfony and Continuous integration

sfAmfPlugin 1.4.2

5. August 2009 in AMF, doctrine, Flex, General, Symfony

I released a new version of the Symfony-Plugin sfAmfPlugin som hours ago. With the new version the communication between Flex and Symfony is easier than ever.The new version brings big improvements regarding the Doctrine Adapters. Relations between classes are handled better now. The error_reporting is working now as it should and there is a default implementation of a gateway module included.I hope you like it and find it useful. And as always I would like to hear from you if there are bugs or feature requests.Get it while it’s hot :-)Timo

Serving PDF Files through Symfony Controllers

3. August 2009 in General, Symfony

A lot of web applications offer to download some kind of PHP file. Maybe you want to implement some kind of export feature or you have paid content in form of a PDF or other media or you just want to secure your PDF files in the same way as the rest of your application (i.e. username/password). If this is the case you wouldn’t place your PDF-files in a subfolder of the web-Directory of your Symfony project, because all these file can be accessed directly via browser.

So how to serve your PDF-Files through a Symfony controller? it is an easy one. Just assume you put your pdf-files in a directory called “media” on the root-level of your Symfony-project.

  |-- apps
  |-- cache
  |-- config
  |  |-- demo.pdf
  |-- media
  |-- lib
  |-- web

These files cannot be reached by Browser, so we  need a new routing information for Symfony to get them accessible via the webbrowser. For that open the routing.yml of your application and add the following rule topmost in this file.

  url: /media/:filename.pdf/*
  param: { module: media, action: show }

From now on if you try to access a PDF-File in the media-folder (i.e. http://domain/media/demo.pdf) the media-Module with the action show is called. That was easy but how to implement this action. First you need to create the media module with the symfony command line tool:

$> symfony generate:module appname media

Afterwards add the following method to the class in the media/actions/actions.class.php file:

public function executeShow(sfWebRequest $request) {
  // being sure no other content wil be output
  sfConfig::set('sf_web_debug', false);

  $pdfpath = sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.'media'

  // check if the file exists

  // Adding the file to the Response object
  $this->getResponse()->setHttpHeader('Pragma: public', true);

  return sfView::NONE;

Thats it! You can improve this Action method a little bit. For example you can add a “download”-switch. If this switch is set to 1 the file is downloaded instead of shown in the browser (i.e. http://domain/media/demo.pdf/download/1).

public function executeShow(sfWebRequest $request) {
  // being sure no other content wil be output

  sfConfig::set('sf_web_debug', false);

  $pdfpath = sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.'media'

  // check if the file exists

  // Adding the file to the Response object
  $this->getResponse()->setHttpHeader('Pragma: public', true);

  // download-switch
  if ($request->getParameter('download', 0) == 1) {
                            'attachment; filename="'.


  return sfView::NONE;

As we now use a Symfony-Controller you can do just use the complete Symfony infrastructure. You like to secure the PDF-files? Just enable the Symfony security mechanisms (is_secure: on in the security.yml) and only logged in users can download them. In the same way you can create paid content.  Or you can add watermarks to your PDF using Zend_Pdf for example.

Hope this is helpful for you.