R
R
Romi2021-11-01 00:06:10
symfony
Romi, 2021-11-01 00:06:10

What fundamentally distinguishes Symfony 5 from Laravel 8?

I'm being tempted here with a Symfony project, but I'm in doubt. The fact is that I have already made simple APIs on Symfony, and I didn’t notice any special differences from Laravel at this level.

But what happens if you dig deeper?

Is there anything that is really different here?

// expand a little: Doctrine is the same Eloquent, only in profile. Well, you have to write these setters-getters, but you can survive it, well, routes in phpdoc are also funny like that. But all this is not fundamental, but is there something that is very different, and what should the laravel developer pay special attention to?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2021-11-01
@romicohen

  1. First of all, you need to understand that any Framework, in the hands of a good developer, will live long and well .
  2. Framework is infrastructure. The Framework does not provide you with ready-made code and does not specify the architecture, it provides you with low-level tools or their quick integration, in which there is no need to write from scratch for each project. Although, for the sake of practice, it would not be bad to try to do this in order to understand this issue, but this is not about that now. Based on this, your code should be independent of any Framework. The Yii2 framework is outdated - the controllers have been changed, a bit of infrastructure and the code is already working on Symfony or Laravel. This is not limited to Frameworks, any third party library should be isolated from direct use. This will allow you to be more flexible and make your code less coupled and dependent.
  3. Both Frameworks are popular and have a right to exist. Everyone has a different entry threshold, different community and different solutions. On Symfony, the code is written a little more complicated and longer, since there are no familiar facades. Many components and frameworks use Symfony components as their wrappers. However, you need to understand that the Framework sets a little style in development, Symfony has a more correct and strict style. Therefore, using Symfony intuitively pushes you to write cleaner code without diving into different patterns.
  4. Doctrine is NOT the same Eloquent. These are completely different things!
    Eloquent is an Active Record anti-pattern and Doctrine is a Data Mapper pattern. If we are talking about fast development and a short-lived or small project, then you can take it, but for a long time it is better to use Data Maper like Doctrine, Cycle. With this approach, your fields "do not stick out" directly from the database into the code. When changing a column in the database, it will not have to be changed throughout the project. For Data Mapper, the approach is Code First, and for Active Record, Table Fist. When using the Data Mapper, we don't think about how our data will be stored in the database, we don't think about what the database will be, which cannot be said from AR.

The topic of frameworks on Q&A comes up very often. Personally, I had to answer such questions many times. You can see for yourself from my answers:
  • Is Yii2 Framework relevant in 2020?
  • Which PHP programming approach to choose in 202...
  • Switching to a PHP framework. Which one?

Therefore, these issues are not taken seriously here. To understand the difference, you obviously need to try both Frameworks in different situations. Over time, you will understand everything. And if you are satisfied with Laravel and no big development is expected, use it. A couple of lines of code can be written without any Framework. The main thing is the result and the right tool.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question