Porting a website from Symfony 1.4 to 2.0 Porting a website from Symfony 1.4 to 2.0 symfony symfony

Porting a website from Symfony 1.4 to 2.0


You may wrap your legacy project in a brand new sf2 project, by using this bundle. This way, you'll be able to migrate your project one piece at a time, and new functionalities may be developed with sf2 as soon as you get the wrapper to work.You may be interested by this post about migrating


Here's how I would go about it:

You need to learn and study some things first:

  • HTTP fundamentals
  • PHP namespaces, which are heavily used
  • Symfony2 documentation
  • Symfony2 documentation
  • Symfony2 documentation
  • PHPUnit documentation

Then when you get the hang of Symfony2, you need to find out what to reuse from your old project:

Models, business logic? Did you use Doctrine in symfony? If yes, look at how to port your entities to Doctrine2, and learn about the differences. If you used Propel, I would look at switching to Doctrine2 and not use the PropelBundle, atleast until you get used to Symfony2. You can find better documentation and sample code out there for Doctrine2.

You also need to convert your old helpers classes to Symfony2 services.

Views?Symfony2 uses Twig as templating engine, but you could go with pure PHP.

Controllers?This should feel somewhat similar to symfony. The flow of Symfony2 matches the HTTP flow, meaning you get a Request object and must reurn a Response object.

It really depends on how well structured our old project is. Symfony2 is an entirely different beast than 1.0-1.4. I would probably not call it a port, but a rewrite - however, if your old project is well structured you could probably reuse quite a bit.

Without actually seeing your code, it's impossible to give a good answer on how hard it would be. It's very much doable, but there is no easy route. Symfony2 is, IMHO, the way of the future for PHP projects and in the end you will get a project that is much easier to maintain and support.