Reputation: 163
I need to learn Symfony 3.4 for a new job but I am finding it very difficult to find well written introduction tutorials. I already tried to learn through the official Symfony documentation but I still have a lot of questions. Since it's much easier to find courses and demo-applications for versions 3.0 and 4.0, I want to know which one is closer to 3.4 so that I can use that information to help learn 3.4.
UPDATE
With all the different answers I decided to learn little of both. What I noticed is both versions have their own differences to 3.4 one. While the version 3 has outdated services like this:Link here
Version 4 has differences in it's structure architecture of version 4
In conclusion, since my problem was understanding the official documentation due to vague experience with php frameworks, MVC model, and Object Oriented programming I decided to learn first the version 4 because it has a bunch of tutorials for beginners and also the symfony-demo.
OBS: This tutorial helped me a lot.
Upvotes: 3
Views: 716
Reputation: 946
If you can, go with Symfony 4.0
A lot of times with Symfony, when we reach the brink of a new major version like 4.0 what you'll find more often than not is that the previous last minor version, in this 3.4 is mostly compatible with it, just that deprecated features are removed.
In other words, the biggest change between 3.4 and 4.0 is that any features marked as deprecated in 3.4 won't work in 4.0.
Whereas the major difference between 3.0 and 3.4 is all the new goodies that convinced the team to leap from 3.4 to 4.0
There are a few minor stuff but this is the biggest difference in my opinion, so go with 4.0 which also has the added benefit of saving you another leap when 5.0 comes out end of next year.
All the best!
Allow me to respond to the other answer that has been surprisingly more popular.
If the question is "Which Symfony version (3.0 or 4.0) is closer to 3.4?" I am genuinely surprised that anyone would say 3.0, genuinely.
Symfony 4 is Symfony 3.4 without support for any deprecated features. - that is the main point here.
Symfony 3.0 is Symfony 2.8 without support for any deprecated features.
Don't take my word for it, check out the official blog on the parity https://symfony.com/blog/category/living-on-the-edge
Notice how 3.4 and 4.0 are grouped, as well as 2.8 and 3.0.
The closest to 3.4 is 4.0, why? You can safely downgrade from 4.0 to 3.4 without issues (unless with 3rd party bundles), you can also safely upgrade from 3.0 to 3.4 but mostly with deprecation notices everywhere not to mention your code lacks the features introduced in 3.1, 3.2 and 3.3. I'm baffled why some would think the closest to 3.4 is 4 minor versions back. But they gave reasons so I'll briefly counter them.
Perhaps the now chosen answer was not aware of this, but directory structure is totally optional, my aforementioned production app uses Symfony 3.4 directory structure in my Symfony 4.1.x backend. Just make sure composer.json is aware of your structure.
"autoload": { "psr-4": { "AppBundle\": "src/AppBundle/" }, "classmap": [ "app/AppKernel.php", "app/AppCache.php" ] },
Symfony 4 advises against using bundles to organize your code, it's not set in stone, again just related to above, let composer know that your code is in src/AppBundle.
Actually, to conclude, most of the reasons stated to choose 3.0 are cosmetic, however, should you want to know which features are in 3.0 that are not in 3.4 take a look at the link I put, here it is again. https://symfony.com/blog/category/living-on-the-edge
In the end, it's people's opinion, and I'm happy to let the popular one carry the day even if it aint my own.
Good luck!
Upvotes: 2
Reputation: 17954
I don't admire or event approve the accepted answer as it is totally wrong!
According to the question by OP,
I need to learn Symfony 3.4 for a new job. Since it's much easier to find courses and demo-applications for versions 3.0 and 4.0, I want to know which one is closer to 3.4?
Obviously 3.0 is the answer.
As the documentation clearly states, Symfony uses semantic versioning strategy:
A new Symfony patch version (e.g. 2.8.15, 4.1.7) comes out roughly every month. It only contains bug fixes, so you can safely upgrade your apps;
A new Symfony minor version (e.g. 2.8, 3.2, 4.1) comes out every six months: one in May and one in November. It contains bug fixes and new features, but it doesn't include any breaking change, so you can safely upgrade your apps;
A new Symfony major version (e.g. 3.0, 4.0) comes out every two years. It can contain breaking changes, so you may need to do some changes in your apps before upgrading.
Also please note that:
Starting from the Symfony 3.x branch, the number of minor versions is limited to five per branch (X.0, X.1, X.2, X.3 and X.4). The last minor version of a branch (e.g. 3.4, 4.4, 5.4) is considered a long-term support (LTS) version and the other ones are considered standard versions.
which means that only major releases (such as 2.0, 3.0, 4.0) are allowed to break backward compatibility. Minor releases (such as 3.0, 3.1, 3.4) may introduce new features, but must do so without breaking the existing API of that release branch (3.x in the previous example)
So, 3.4 is the LTS and gets support for 3 years. You may also check their Backward Compatibility Promise for more information.
Symfony 3.4 & 4.0 have exact same features but different implementations.
According to Symfony 4 Introduction page, It was a major release with bunch of whole changes to the framework:
| Feature | 3.0 | 3.4 | 4.0 |
|--------------------------------|-----|-----|-----|
| Flex | No | No | Yes |
| Recipes | No | No | Yes |
| Micro-Kernel Start | No | No | Yes |
| Using Bundles To Organize Code | Yes | Yes | No |
| Directory Structure | Old | Old | New |
| composer.json Structure | Old | Old | New |
| Routing Definition | Old | Old | New |
| Configuration | Old | Old | New |
| Routing Annotations | Old | Old | New |
So if you need to learn 3.4 and you have a choice between 3.0 and 4.0, stick with 3.0 and forget about 4.0
Upvotes: 4