DEV Community

loading...

Discussion on: Debate: Symfony VS Laravel

Collapse
_garybell profile image
Gary Bell

Given that laravel uses a lot of symfony components, I see it as an extra layer on top of symfony.

I've never properly used Laravel (possibly going to explore it for my next project) but I'm building an application now which uses a lot of symfony components itself.

I really like the flexibility Symfony brings. Use only what you need, and nothing more. Yes you can start from website-skeleton and have more than you thought you would need. But you can also just use parts like httpfoundation and build everything else yourself.

Collapse
itsmukulmishra profile image
Mukul Mishra Author

Yes symfony leads in this case. When I installed laravel hundreds of symfony packages were installed. Laravel is bigger ofcourse but core is built by symfony components

Collapse
mazentouati profile image
Mazen Touati

I've first used Symfony 2 and 3 then I started using Laravel 5 (now it's version 8). I've never looked back since.

@Gary Bell

Symfony alone is a general term that combines Symfony components and Symfony framework.

Symfony components is a robust php components library the same as The PHP League and Aura (more at Awesome php).

Beside Symfony components Laravel has its own set of components called "Illuminate". They are kind of coupled to the framework however a project like Torch shows how you can use them outside Laravel.

Symfony framework in the other hand is a suggestion by the same author for an architecture and code structure built on top of Symfony components.

Laravel uses some of Symfony components plus other vendor components and created its own set of components.
As I type this message Laravel and all its components uses exactly 11 unique Symfony component out of at least 40 unique external package it uses (check Laravel dependency graph).

Here's the list of unique components it uses. I made the extraction manually it's possible that I missed one or two.

symfony/finder
symfony/debug
symfony/console
symfony/routing
symfony/http-kernel
symfony/http-foundation
symfony/process
symfony/mime
symfony/var-dumper
symfony/error-handler
symfony/cache
Enter fullscreen mode Exit fullscreen mode

Some of them are for debugging or console usage. When using Laravel you won't be directly exposed to these components as they are nicely wrapped by Laravel components and helpers.

Using any external component is not a degradation to the value of the product. Why would the author re-invent the wheel when there's already a well-tested component that serve his needs?


@Mukul Mishra
On a clean Laravel 8 installation, there's only 28 unique symfony packages being installed. The extra components are installed through external vendor Laravel uses and are not directly used by Laravel.

Regardless, how come hundreds of symfony packages being installed with Laravel while the whole Symfony components library contains only 73 packages?

Considering the list of Symfony components that Laravel really uses (listed above) do you really think that Laravel core is only built using Symfony components?