acmeextension

Which framework should I use? Symfony or Laravel

By: Sunil Kumar |  In: PHP  |  Last Updated: 2018/06/26

'Does Symfony give more business opportunities?'

You must have heard such questions before There is a ton of excitement around Laravel, and it's built off Symfony2 components.

The two frameworks obviously have a lot of similarities, so I wonder, why would someone choose to use Laravel instead of Symfony2? And vice versa.

According to me, You can't say that using Symfony is more beneficial than Laravel because It depends on which type of project you want to develop. If you are building a small project with simple logic you will find Laravel more suitable while if you are trying to make a complex project Symfony will best suits to your requirements. Also If you are a newbie you will find Laravel more simple and easy to learn while Symfony is not.

Both the framework are popular and doing great in the Industry. While laravel is growing strong But Symfony is more stable in business industries. Most of the high-profile companies searching for the Symfony developer. So here I will try to compare both with some features of them

  • The main difference between Laravel and Symfony is the learning curve. Laravel has isolated the most common things needed in a framework does and abstracts away everything "unnecessary" which cuts both development time and head scratching.
  • Symfony is more down to business and requires a better understanding of the framework and its components.
  • Due to Laravel simplicity and relative code terseness, the time for writing a code sufficiently decreases.

Performance and scalability

Symfony and Laravel are caching views, though Symfony is also caching source code by default. Remember the fun fact that Laravel is built with Symfony. What is more interesting is that Laravel works faster when Symfony is caching source code. Quite a performance boost! By the way, the average loading time for websites on Laravel is reported to be about 60 milliseconds, while for ones on Symfony about 250. Also if we see application startup time Laravel is again king over Symfony. Laravel start-up time is 1ms as compared to 2ms in Symfony.

Routing

In Symfony, there're 4 ways of defining a route. I know, defining a route is not "all there is", but I think it's a great example.

  • with YAML
  • with PHP
  • with XML
  • with Annotations in the Controller.

While in Laravel 4, there is a single way to define routing

  • routes.php

Documentation

Laravel is a little skim because the framework is kind of new, but it does a good job of covering the things you need to get going. Symfony's documentation is very rich. You will find everything with the example. Symfony has a great community also.

Templating Engine

Here Laravel beats Symfony. Laravel has more Templating Engine as compared to Symfony. But I prefer using Twig which is available in both Symfony and Laravel.

  • Laravel:- Blade, Php, Smarty, Twig
  • Symfony:- Twig, PHP

Database

Symfony supports almost all the popular database while Laravel supports some of them.

  • Laravel:- SQLite, MySQL, PostgreSQL, Redis, Microsoft BI, MongoDB
  • Symfony:- Microsoft BI, MongoDB, MySQL, NoSQL, PostgreSQL, CouchDB, DynamoDB, GemFire, GraphDB Membase, MemcacheDB, Oracle, Apache Jackrabbit

Symfony is extremely modular

Symfony is extremely modular. Everything in Symfony is a bundle (of MVC goodies), which makes the framework architecture very extensible and flexible by design. It works wonderfully well with the composer, namespaces and autoloaders & all important aspects of a well-structured application. This thing is missing in Laravel.

Maybe some things are kept simple But its lack of structure is something I hate whenever I see fat controllers spread logic where they don't belong. It makes it simple But it's not worth if you are scarifying quality of code and maintainability over simplicity.

Conclusion Laravel is basically a simplified Symfony2 (routing, HTTP, etc ..).

If you have already mastered Symfony2, why would you want a simplified version of it? There is no reason laravel provide. You might be tempted to take up Laravel as it can be much easier to learn and everything can take less time to develop with it since Laravel was built for rapid development purposes. But Symfony is more down to business and requires a better understanding of the framework and its components. So if you are going for a complex application I suggest you go with Symfony. but if you are building a simple application go for the Laravel.

Comments


Leave a Comment

Your email address will not be published.

*


Sunil Kumar


I am the owner of acmeextension. I am a passionate writter and reader. I like writting technical stuff and simplifying complex stuff.
Know More

Subscribe to our mailing list


%d bloggers like this: