Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Friday, December 11, 2015

The difference between Symfony and Silex

The difference between Symfony and Silex


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 by Lusitanian for The difference between Symfony and Silex


Silex is based on the independent Symfony2 components and isn't truly considered a full-stack web application framework like Symfony is. You should only use it for very small projects that only require a few files, or you'll outgrow it pretty quickly.

Answer by igorw for The difference between Symfony and Silex


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.

Answer by ivoba for The difference between Symfony and Silex


Here are some interesting thoughts on when to use Silex (especially in the comments): http://www.testically.org/2011/10/11/is-there-a-specific-situation-when-to-use-a-php-micro-framework-like-silex/

Silex itself is pretty bare, which means that if you want more then just routing and tests you will need to add specific features (DB, Twig ...) in form of Services. I recommend to take a look at some readymade Plates that provide you with this: https://github.com/lyrixx/Silex-Kitchen-Edition or https://github.com/ivoba/superleansilexplate (thats mine :))

Another point is that Silex has a probably lighter footprint than Symfony2, so if you need a smaller & faster site, Silex is worth a consideration.

Answer by olanod for The difference between Symfony and Silex


Silex is good for small projects, but it can be used for big projects as well. What I like the most of Silex is that I have complete control over my project structure but it's my responsibility if my project is well organized or not.
Also I recommend it over symfony if like me, you moved your application logic to the client side using a JS framework. For me it feels an overkill to use symfony only to serve a few json requests.

Answer by user2779489 for The difference between Symfony and Silex


Silex is a PHP microframework. It is use for the small project.The coding style of the symfony and the silex is almost similar to the symfony.But the symfony is use for the large projects

Answer by GlupiJas for The difference between Symfony and Silex


(UPDATE) Since Symfony 2.8 You can use symfony 2 as microframework with micro kernal controller. See a short description: symfony.com/blog/new-in-symfony-2-8-symfony-as-a-microframework. Now symfony gives Us more controll over the structure and architecture. Good alternative to Silex if You prefer the symfony 2 style.

Comparing Silex to Symfony before 2.8 releas

Silex micro-framework is based on Symfony but it is not exactly the same thing. Using full-stack framework such us Symfony for small project is simple overkilling the project.

In microframework you have more flexybility at chooseing tools you want to use, You can make more decisions about aplication architecture and logic. In fullstack framework with some extend you would have architecture and logic already predefined with restrictions and limitaion to it configuration.

Silex was design to build up the tool rather than get the set tools that you mighnt not need or use. I would say that for small projects in Symfony you would have to remove fetures - were in Silex you would have to add them.

It is also not true that silex do not feet for larger projects. Silex can be use with success for larger projects but remember that you would have to build up your tool to feet your requierments (if you need to customise architecture and logic - perhaps this is the right way to go). Other than that I would consider of using Symfony instead because Symfony alrady has banch of tools available out of the box.

Silex dependency injection

Bear in mind that: Silex limitations

Concluding. Silex is good for small aplications and for those it can surely replace Symfony. Silex can also be used for larger projects (but for larger aplications I would recomend to use fullstack framework instead - like Symfony).

Reference for slides at: http://www.slideshare.net/dustin.whittle/silex-from-micro-to-full-stack . If you feel like go ahead and read up some more about Silex framework.

I also recomend to watch this intro about Silex with comparison to Symfony: https://www.youtube.com/watch?v=RDVtnsoOysE.

Again few Pros for using Silex from people who actually using it: https://www.youtube.com/watch?v=OJcdHGJFfLU


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 71

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.