Symfony или laravel


PHP is great and modern programming language for web development. Powering about 80% of all web application, it would be unreal to code each of them from scratch. Web developers utilize various frameworks and tools to speed up repetitive tasks. Yii, Phalcon, Slim, or Codeigniter… there is no shortage of such, but for our PHP framework comparison, we’ll take 2 top environments, namely Symfony vs Laravel.

All in all, general benefits of using PHP frameworks are:

  • Faster development
  • Organized and reusable code
  • Scalability of web applications
  • Separation of presentation and logic (under MVC pattern)
  • Relevant practices and tools

Laravel undisputedly has grown to be the most popular framework, according to surveys and Google Trends period of last 5 years (2012-2017). Though Symfony, being 2nd framework in use, powers larger projects like Drupal CMS, and miraculously enough Laravel.

Further on we will be scrutinizing Symfony vs Laravel going through key parameters and considerations of web app development. But let’s start with some basic information to compare these PHP frameworks to build web projects.

Parameter Symfony Laravel
Launch year 2011 2011
Current version 3.3 5.4
LTS (long term support) + +
License (Free for commercial use) MIT License MIT License
Number of packages 7,500 16,900
Number of open-source projects 25,300 76,200
Number of questions at StackOverflow 51,500 67,900
Github stars ratings 14,900 7,800
Number of contributors 1,400 1,400

General introduction

Symfony framework by French company Sensio Labs offers a lot of reusable components, libraries, and packages. With it, a web developer may deal with tasks like object configuration, authentication, templates, etc. Packed with lots of features, it is not too overwhelming to get familiar with, too. In terms of structure, it is a flexible full stack and uses Twig as a template engine. For a nice introduction to Symfony, watch this video by Linkedin Learning.

What is great about Laravel framework in particular, is the wide and vibrant community and plenty of support materials/tutorials for any aspect of it. Beside rich features and ability for “rapid” web development, it has its own templating engine Blade, and a sub-framework for PHP Lumen, for coding APIs and other microservices. Check out a video introduction to Laravel community.

Of course, both frameworks have many similarities. Both working in PHP programming language, both are cross-platform in terms of operating systems, both are multi-user and multi-language content. Both Symfony and Laravel are related to MVC (model-view-controller) pattern for interfaces, support text search, and scaffolding.

Now, let’s move on to feature comparison of Laravel vs Symfony.

Code organization

Symfony consists of reusable components and offers better modularity. While both these frameworks utilize the MVC architecture to develop web applications, Symfony is a better option for complex projects. One can work numerous components in it for one project in a modular fashion. This enables faster development.

Get free estimation for your web app

Post your project or request a dedicated team — we’ll quickly match you with the right experts.

Where Symfony and Laravel differ is the template engine. It is Twig for Symfony and Blade for Laravel. Blade is considered to have an upper hand due to code reusability. There’s no need to define the same function twice, like in Twig.

Parameter Symfony Laravel
Patterns Factory, Composite, QueryBuilder, Flyweight, Observer, Dependency Injection, Data Mapper Builder, Factory, Repository, Strategy, Provider, Facade, ActiveRecord, Dependency Injection
REST API compatibility + (with FOSRestBundle) +
Scaffolding + +
Multilanguage + +
MVC + +
HTML templating Twig Blade
Installation via composer + +
PHP Standards Recommendations + +
ORM + +
PhpStorm plugins, support + +
Multiply drivers support DB, storage + +
Full text search + (ElasticSearch) + (ElasticSearch)
CI support, QA PHPUnit

Both Laravel and Symfony imply object-relational mapping (ORM) technique for data conversion. As there are several installation procedure options for these frameworks, one is able to install both of them via composer, which is always a relief for a developer.

Continuous integration (CI)

Every time as there are changes to the code, a review is required, along with certain tests and re-configuration. CI (continuous integration) is a practice that automates such tasks aimed at errors at early stages. There are various continuous integration servers and tools within PHP environment, so let’s see how our frameworks support CI services. This is round 2 of our small Symfony vs Laravel contest.

CI Service Symfony Laravel Comments
Travis Ci + + Works through Git and is not dependent on any framework.
Style CI + + Works through Git and has presets for both Symfony and Laravel.
Drone + + Works through Git and is not dependent on any framework.
Codeship + + Supports all popular PHP frameworks, works through Git, valid parameters needed.
Circle CI + + Works with all frameworks, has documentation and PHP Laravel demo.
Jenkins + + Works through Git, independent of any framework, has Laravel template.

While Jenkins seems to be quite a popular CI server, you can find self-hosted CI packages from Laravel and Symfony. Regarding database support, Symfony is considered to be a winner (NoSQL, Dynamodb, and more), and Laravel has less in its pocket.

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.

Test case

For the purpose of our analysis and to compare Symfony vs Laravel performances, we’ve decided to create a test web application. A simple one-page app for each framework with a single action upon opening it.

The task was to:

  • Extract 1,000 items from a database (each with unique title, price and stock)
  • Make 1,000 orders for all of them
  • Update stock quantity in the database
  • Calculate the total order price

We conducted load testing simulation (using Apache Benchmark) for two largest web servers powering the Internet: Apache and Nginx. Check the results in the table below.

Symfony (seconds) Laravel (seconds)
Apache (10 requests, 1 user) 15.35 6.50
Apache (1 000 requests, 10 users) 638.56 202.66
NginX (10 requests, 1 user) 7.53 6.44
NginX (1 000 requests, 10 users) 658.73 211.85

Documentation and learning curve

In regards to learning materials and documentation, Laravel beats Symfony strongly. It’s tutorial and support videos (i.e. Laracasts) cover everything from A to Z, and materials at their Laravel Github docs are extensive. Symfony documentation is naturally also available explaining its components, bundles, service containers and more.

Parameter Symfony Laravel
Learning curve Middle Low
Installation complexity Low Low
Events/Community + +
Documentation Basic Textual and video
Certification + Upcoming

Most of web developers argue that the learning curve for Symfony is a bit (or quite) higher compared to Laravel. The latter feels more intuitive and suits fine to build back-end part of web projects, while preferably working on front-end with JavaScript frameworks like Angular.

Symfony vs Laravel: summary

To be frank, Laravel has caught the momentum in recent months. It is better for large-scale web projects that require faster delivery with fewer resources. At the same time, Symfony is better for complicated enterprise-level web applications, and also demands developers of higher skills.

To summarize, main advantages of Symfony web framework are:

  • Multiple options for extensibility
  • Faster than most of other PHP frameworks
  • Adaptability and optimal performance (HTTP-centric request/response)
  • Reusable components that reduce time and cost

And main advantages of Laravel web framework are:

  • Advanced query builder mechanism.
  • Painless data migration and overall management
  • Auto-loading facility (no need for manual maintenance)
  • Simpler authentication
  • Event object principle instead of event string for handling new events in applications.

Which one to choose, is your choice only.

Get free estimation for your web app

Post your project or request a dedicated team — we’ll quickly match you with the right experts.