DEV Community

Cover image for Symfony 4 is the new Boss in PHP Framework

Symfony 4 is the new Boss in PHP Framework

gdahboy on October 06, 2019

Table Of Contents *Introduction *Component *Form *Translation *Bundle *Doctrine *Annotations *Migrations *Services *Logger *Pe...
Collapse
 
quietobserving profile image
Andrei

Well, I do agree that Symfony 4 is "the boss" of frameworks at the moment, but definitely not because of all the stuff listed.
In fact, the stuff listed in the article are the reasons why Symfony 3 became Symfony 4, by stripping down most of the features included by default in the framework in an effort to make it leaner and faster.
The advantage of Symfony 4 is that you can strip it down and make it lighter (both in disk size and loaded functionality), but even so it still performs poorly in terms of sheer speed and memory footprint (look at Ubiquity 2 or Symlex - just don't mistake it for Silex).

The world has already moved away from fullstack frameworks (even backend monoliths would be frowned upon when starting a new project). If I were to make a new API project, the stack would look more like:

  • PHPDI - dependency injection container
  • thephpleague router
  • monolog
  • thephpleague plates (for templating, significantly faster than twig - if you need server side rendering)
  • Doctrine (speaking of which, the Doctrine items you listed are Doctrine advantages, not Symfony advantages)
  • roadrunner as the PHP application platform (if you haven't tried it, you should) OR symlex (which is still a fullstack framework, but with true modularity)

The reason being that the first 3 are PSR-compatible components, whereas Symfony needs an additional translating service to normalise its requests/responses in a way that allows you to take advantage of its modularity (also, if requests/responses aren't PSR-compatible you can't use an application platform like roadrunner for true concurrency & paralellism).

Collapse
 
gdahboy profile image
gdahboy

The article meant to be for beginners not for seniors ... thanks for the comment it add more to our subject

Collapse
 
avantar profile image
Krzysztof Szala

Thanks for your comment. I must say – it was more valuable for me than the whole article! ;)

Collapse
 
noccy80 profile image
Christopher Vagnetoft

I used to hate Symfony 4 coming from Symfony 3. Nothing was preinstalled like I was used to, you had to use Flex to install things. Now that's one of my favourite parts about it. Start barebones and add what you need, and everything just plugs in and works! It's fantastic! :)

Collapse
 
gdahboy profile image
gdahboy

sorry to forget mention it . Flex is one of the greatest advantages of symfony 4 add to that the new architecture and project model of symfony 4 make it greater to use .

Collapse
 
noccy80 profile image
Christopher Vagnetoft

I agree. The messagebus and the workflow components are two I've found really useful as of late, and thanks to Flex only a "composer require workflow" away :D As said, I hated it at first, but it has made things both easier and leaner. Good post! Symfony is indeed the Boss :)

Collapse
 
bcalik profile image
Burak Çalık

What about Queues?

Collapse
 
wolfyj profile image
Anton Titov

RoadRunner has integrated Queries, you don't even need a framework for it anymore.

Collapse
 
bcalik profile image
Burak Çalık • Edited

Roadrunner is just a replacement for nginx+php-fpm pair. You still have to write your own queue implementation in your application, you won't have features like failed jobs, delayed jobs, max attempts, expirations, chained jobs etc. You have to waste many hours.

Thread Thread
 
wolfyj profile image
Anton Titov • Edited

It is not just a replacement and it does have most of the features you mention. It also have automatic reconnects for queue brokers which it near to impossible to achieve in php. Check this repo: github.com/spiral/jobs

It can also run queue in memory, so you don’t need any broker.

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
bcalik profile image
Burak Çalık

What does it have to do with Queues?

Collapse
 
zspine profile image
M#3

Hi @burak ,

You mean to work with RabbitMQ etc? If so Symfony Messenger can be used to work with queues.

Collapse
 
dbunt1tled profile image
unt1tled

Great article!
But I think are general advantages inherent in other frameworks such us Yii2 or Laravel (exclude Annotations, but many developers didn't think this advantage, because they confused and complicate writing tests).
Symfony loves for the discipline of writing clean code.
(Sorry english is not my native language)

Collapse
 
gdahboy profile image
gdahboy

this article hasn't yet cover everything . there's a lot common in PHP frameworks and we will go through disadvantages with a newer articles .

Collapse
 
girlsugames profile image
GirlsUGames

Thanks for your review! why most frameworks don't make the workspace visualized?

Collapse
 
cdsaenz profile image
Charly S.

I've been a happy Codeigniter user for years. Tested Laravel at the time but seemed complicated. Now I might be looking again, Symfony included. I want a cleaner template, more powerful ways to build sql queries/searches. We'll see.

Collapse
 
gdahboy profile image
gdahboy

i think that the right place is symfony ... well to be honest at first it may seems complex at the begging but when you use to , you will see how great to use it

Collapse
 
saddem123 profile image
saddem yassin

Nice work friend i like it even i hate php and his frameworks

Collapse
 
gdahboy profile image
gdahboy

the idea behind this article is to choose the best framework of PHP frameworks