K
K
Kir ---2012-02-22 23:35:29
symfony
Kir ---, 2012-02-22 23:35:29

Differentiating Symfony 2 and Yii?

Now at a crossroads. We need to start developing a serious RIA with a long life cycle. And therefore there is a serious choice between 2 frameworls.
At the moment, according to the documentation, I found the following differences (maybe I'm wrong).
ORM.
Yii has Scope, Symfony 2 has Filter's and Repositories instead, but they are not as convenient as Scope and you need to produce entities.
cache.
Both have query, model, and page level caching. Yii also has caching at the level of page fragments and data.
Access.
The approach to access in Symfony 2 is based on ACL, in Yii on RBAC (ie Yii is preferable here)
Easy to learn.
It seemed to me that Yii is much easier to master than Symfony 2. At the same time, the capabilities of the frameworks are almost the same. Yes, and with documentation in Russian, Yii is better.
Everything described above is my personal impressions after reading the documentation and creating applications a little more complex than "Hello world".
I turn to the masters, where am I wrong and what did I lose sight of (distinguishing)?
ps
The issue with PHP is resolved and the choice is only between these two tools.

Answer the question

In order to leave comments, you need to log in

9 answer(s)
K
Kir ---, 2012-09-10
@SowingSadness

Symfony 2 is not as bad as I thought.
They just don't write how to use it correctly.
Those who say that it is difficult, but better, also have no idea how to properly “cook” sf2 + doctrina.
All Entities remain just Entities without any logic, only getters and setters.
All business logic is made out in the form of services.
In controllers, only checking parameters and calling the appropriate service.
All other claims about errors, events and Forms to Sf2 remain.
But with the Data Mapping approach, the complexity of writing and maintaining a product is really reduced.
Those. only Data Mapping played a role here. In Symfony 2, there is a big problem with the fact that the DI Container
is not written correctly .
And so the whole code is practically reduced to the use of global variables. Compare:

$myService = $this->getContainer()->get('myService');
/* vs */
global $myService;

The advantage of Sf2 here is solely that when using services, we know that something is there. Not the fact that something is needed, but something lies. Which doesn't make it any easier.
Which framework should I choose Yii 2 or Symfony 2?

E
ExxY, 2012-02-22
@ExxY

If you want to sketch blogs quickly, choose Yii. He is simple.
If you are going to make a serious application, if you know why you need Dependency Injection, if you need to cover most of the code with tests, if you need a super-cool modular architecture, work with migrations and fixtures - only Symfony 2.

D
dutchakdev, 2012-07-23
@dutchakdev

Whatever I do, wherever I go, I choose Yii. I don't want to change anything else. There are so many reasons for this that this is a whole separate article, which has been rewritten a million times by other people who have fallen in love with this miracle!

V
Vladimir Chernyshev, 2012-02-23
@VolCh

I didn’t work closely with Yii, so it’s just an opinion:
ORM in Symfony (Doctrine2), IMHO, is more powerful than in Yii by definition. DataMapper+UoW vs ActiveRecord. Plus, SQL-based DBMS storage can be replaced with something else without any problems, MongoDB, for example, is also almost out of the box. But, probably, DM is somewhat slower than AR due to the extensive use of reflections. It is solved by creating custom repositories, where you can even directly call SQL without using DBAL.
Access in sf2 can be based on anything, the main thing is to implement isGranted(). Role-based - out of the box.
In general, modularity and low coupling is a strong point of sf2 (not least because of DI where it is needed and where it is not needed :) ). Other full-stack PHP frameworks, which I have superficially studied, cannot boast of this. In sf2, hard links are little used, almost everything is configured: the proposed abstractions of the router are not needed - write your class at least in switch case, at least in C, the main thing is to implement the required interface and correct the line in the config (or you can not edit it, but, IMHO, don’t costs).

W
wartur, 2012-11-28
@wartur

Thanks to the author of the topic for raising the issue. I myself have been writing in Yii for about half a year now. I advise everyone. Easy, simple, practical, everything is there, a lot of third-party modules (there are more than 3 of them in my project, at least 2-3 weeks of work are saved)
I came across this topic to find out if I was ripe for more “powerful” academic frameworks like SF2 or ZF2 and judging by the reviews I understood something for myself.
I’ll also say that I don’t like ZF2 because of the severity (at least 2 times slower to start the kernel), and “verbosity” (there is a lot of scribbling to be generated in the code)

D
des1roer, 2015-02-19
@des1roer

yii I didn't like the documentation very much at first. msdn is gods compared to it. but wedged into the topic, I began to like it more and more (I didn’t really use others)

T
tamtakoe, 2012-11-27
@tamtakoe

Inori , as I understand it, you support and even promote simfony among developers. Why don't you look into the misunderstandings of SowingSadness and write some explanatory articles based on it? Also, the fact that everyone around is talking about a high threshold of entry should be a good wake-up call, which hints that you, too, have not worked hard enough to lower it. After all, the threshold is determined only in half by the architecture, and in the other half by the work of the community and the availability of adequate material: examples, solutions to popular problems, open projects. Sometimes, one person can so chew and popularize the technology that everyone starts using it, despite some shortcomings. I hope that you will become such a person in simfony and we will be grateful to you!

C
cystbear, 2012-07-12
@cystbear

And so RBAC checks all operation entirely. No matter how we try to do it.

that is, it turns out for RBAC we need to define / make / describe high-level / abstract tasks. Like sending a letter, right?

V
Vasily Norman, 2016-12-08
@norgen

The implementation of permission checking in Symfony2 is conveniently done using Voters. In my opinion, it is even more convenient and flexible than RBAC. symfony.com/doc/current/security/voters.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question