How 7.4 and 8.1 differ

โ† How 7.4 and 8.1 differ

Ashterix

docs(articles): English translation of From Magento to Symfony

en/articles/magento-to-symfony/practice/versions.md new file +55 โˆ’0

1 + # How 7.4 and 8.1 differ
2 +
3 + As of 2026-10-27, according to [symfony.com/releases](https://symfony.com/releases).
4 +
5 + Symfony 7.4 and 8.0 were released at the same time in November 2025 with the same features. The only difference is deprecated code: 7.4 keeps all the compatibility layers of the 7.x branch, while 8.0 removed them. In other words, 8.0 is 7.4 without deprecations. 8.1 was released in May 2026 and added new features on top of 8.0. The backward compatibility promise applies, so moving from 8.0 to 8.1 requires no code changes.
6 +
7 + | Aspect | 7.4 LTS | 8.1 |
8 + |---|---|---|
9 + | Release | November 2025 | May 2026 |
10 + | Release type | LTS, the last minor version of the 7.x branch | a regular minor release of the 8.x branch |
11 + | Support | bug fixes until November 2028, security until November 2029 | until January 2027; then 8.2 (expected in November 2026), 8.3, 8.4 LTS (expected in November 2027) |
12 + | PHP | 8.2+ | 8.4+ |
13 + | Deprecated code | works, logs deprecations | removed in 8.0 |
14 + | New features | none until 8.4 LTS | every six months in a new minor version |
15 + | XML config for the container and routing | works, but deprecated | removed; YAML, PHP and attributes remain |
16 +
17 + ## What breaks when moving from 7.4 to 8.x
18 +
19 + - **PHP 8.4.** Without it, Composer won't install a single 8.x package.
20 + - **`Annotation` namespaces.** `Symfony\Component\Routing\Annotation\Route` no longer works, and routes using it simply disappear. You need `Symfony\Component\Routing\Attribute\Route`, and the same applies to other attributes.
21 + - **Constraints with an options array.** `new Assert\Length(['max' => 800])` has to be rewritten with named arguments: `new Assert\Length(max: 800)`.
22 + - **XML config.** Services and routes in XML have to be moved to YAML, PHP or attributes.
23 + - **Dependencies.** Every bundle in `composer.json` must allow Symfony 8. A package constrained to `^7.0` blocks the upgrade until its authors release a compatible version.
24 +
25 + The most reliable way to find all of this in your code is to run the tests on 7.4 with deprecation output and fix every one. You fix a direct deprecation in your own code, an indirect one (from `vendor/`) by updating the package. Rector is handy for bulk replacements.
26 +
27 + **Symfony** ยท the 7.4 โ†’ 8.x path
28 +
29 + ```bash
30 + vendor/bin/phpunit --display-deprecations # on 7.4: fix every deprecation
31 + composer require "symfony/*:^8.1" # or change the constraints in composer.json and run composer update "symfony/*"
32 + bin/console cache:clear
33 + vendor/bin/phpunit
34 + ```
35 +
36 + ## What's new in 8.1
37 +
38 + | Area | What appeared | Why it's useful |
39 + |---|---|---|
40 + | Applications without HTTP | a full DI container without HttpKernel | workers and console processes without the HTTP layer |
41 + | Console | several commands in one class (method-based commands); argument resolvers that turn input into typed values and objects | fewer wrapper classes for console entry points |
42 + | Messenger | batch fetching (`--fetch-size`), AMQP priorities, smarter retries, configurable reset (`--no-reset` accepts a number) | cheaper workers on large queues |
43 + | DependencyInjection | lazy env loading for long-running workers, stacked decoration, `decorates_tag`, deeper integration with `#[Target]` | decorators for a whole group of tagged services |
44 + | Validator | new constraints, Clock support, reentrant validators | date validation via Clock is testable without real time |
45 + | HttpClient | persistent cURL, Guzzle handler, custom DNS, SSRF allow-list, mocking a specific client | faster calls to neighbouring services, simpler integration tests |
46 + | RateLimiter | the `#[RateLimit]` attribute, calendar-based window mode | rate limiting right on the controller, without a custom listener |
47 + | HTTP controllers | the `#[Serialize]` attribute for the response, extended `#[Cache]`, files and variadics in payload mapping, request header mapping | less code in API controllers |
48 + | New components | DeepCloner (deep cloning of object graphs), Tui (full-screen terminal interfaces) | DeepCloner is for state snapshots in tests and caches |
49 + | Profiler | "Copy as cURL" for a request, a more accessible toolbar, smarter `debug:*` | a request from the profiler is easy to reproduce in the terminal |
50 +
51 + ## What to choose
52 +
53 + - **A new project**: 8.x. Upgrade every six months: 8.1 โ†’ 8.2 โ†’ 8.3 โ†’ 8.4 LTS. Minor upgrades don't break code, and 8.1 is supported only until January 2027.
54 + - **An application that won't be upgraded for years**: 7.4 LTS: security fixes until November 2029, but no new features.
55 + - **Moving from 7.4**: first reach zero deprecations on 7.4, then go straight to the current 8.x, skipping 8.0: its support ended in July 2026.