The difference between Symfony and Silex

Alex L. picture Alex L. · Jun 30, 2012 · Viewed 24.8k times · Source

I would like to try Silex but i've some questions.

I know to use Symfony2 and i would like to know if Silex is very different of Symfony or it's the same thing (same operation, same code... ) ?

Moreover, Silex is recommanded for small PHP projects and Symfony for medium or big projects , it's true ?

Answer

igorw picture igorw · Jun 30, 2012

A few things worth noting:

  • Silex is based on the Symfony2 components, just like the Symfony2 framework is. As such, it can be considered an alternative user interface to the components (the user being a web developer).
  • Since they use the same basis, migration between them should be relatively easy.
  • Just like Symfony2, Silex is mostly a controller framework. It provides you with some structure, but the model and view parts are handled by third-party libraries (such as Twig or Doctrine).
  • Since your business logic should not be in your controllers anyway, if you separate that code out and keep your controllers light, the limiting factor in terms of project size will only be the amount of routes you have.

That said, Silex will not give you the bundles that Symfony2 has.