Symfony 6.4 or 7.0? Which Symfony version to choose for your new projects?
Symfony 7 is here
Symfony 7 was released on November 29st 2023.
Update now to the best Symfony ever!
- 2 years of development
- 600 diverse contributors
- +6,500 commits
- Requires PHP 8.2 or higher
Command Profiler
Collect information when running commands to introspect and debug them. Automatically available for all commands, including yours.
$ php bin/console --profile app:my-command
Request Data Mapper
Map the incoming request data to any of your DTO objects and get a fully typed and validated object in your controller actions.
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
class ProductApiController
{
public function __invoke(
#[MapRequestPayload] ProductReviewDto $review,
): Response {
// here, $review is a fully typed and validated
// representation of the Symfony request data
}
}
Smaller
Symfony 7 source code removes all deprecations from 6.4, which results in:
- 41 fewer directories
- 264 fewer files
- 47,386 fewer lines of code
Fully Typed
Symfony 7 adds native PHP types to all properties and method return values.
This improves error handling, debugging, and auto-completion in your IDE.
Profiler redesign
The Profiler that you know and love, but with a modern and fresh look. An improved UX and UI will make your debugging experience even better.
Locale switcher
Change the entire application locale with a single method call. Or run some code with a specific locale without affecting to the rest of the application.
Dynamic constraints
Use the new When constraint to apply other constraints conditionally, only when the given expression matches.
AssetMapper
Build a cutting-edge frontend by leveraging modern web standards like ECMAScript modules (ESM), importmaps & preloading, with zero building or complex Node setup.
1. Install JavaScript packages in your application:
$ composer require symfony/asset-mapper
$ php bin/console importmap:require js-confetti
2. Start using them immediately:
// assets/app.js
import JSConfetti from 'js-confetti';
const jsConfetti = new JSConfetti();
jsConfetti.addConfetti();
Rock-solid stability
Symfony 7 is built with the latest version of the Symfony Components, the most popular set of PHP libraries. Battle tested in all popular PHP projects and with billions of downloads.
Smooth upgrade
Our Backward Compatibility Promise ensures that upgrading your applications to Symfony 7 will be a smooth experience. Learn more about how to upgrade to a major Symfony version.
Early Hints
Improve the perceived performance of your websites and web apps by telling browsers which resources to download even before receiving the response contents.
// ...
use Symfony\Component\WebLink\Link;
class HomepageController extends AbstractController
{
#[Route("/", name: "homepage")]
public function index(): Response
{
$response = $this->sendEarlyHints([
new Link(rel: 'preconnect', href: 'https://fonts.google.com'),
(new Link(href: '/main.css'))->withAttribute('as', 'stylesheet'),
(new Link(href: '/app.js'))->withAttribute('as', 'script'),
]);
// ...
}
}
New components
- Scheduler: trigger and send messages on a predefined schedule.
- Webhook and RemoteEvent: define your own webhooks and respond to remote events.
- HtmlSanitizer: create safe and spec-compliant HTML code.
- Clock: improve the testability of your time-sensitive code.
PHP attributes
Built-in PHP attributes to configure routes, cache, security, templates and entities. No more distractions editing separate configuration files.
Access Tokens
Use access/bearer tokens to authenticate users in your APIs. Out-of-the-box support for OpenID Connect servers.
DatePoint
A modern DateTime implementation that fixes all issues from PHP native types and provides full integration with the Clock component.
New integrations
Integrate with more third-party mailers and notifier services. In total, Symfony provides +100 integrations, including Amazon, Microsoft and Google.
New features
More than 450 new features. Discover the main new features of Symfony 7.0.
Documentation
Read the Symfony 7.0 docs to learn about the new features and the main changes.
Upgrade
Read the guide about upgrading a major Symfony version (e.g. from 6.x to 7.0)
Notes:
- Development and performance stats are calculated comparing Symfony 6.0 to Symfony 7.0.
- Highlighted features were introduced in different Symfony 6.x versions and show the differences between Symfony 6.0 and Symfony 7.0.
- Icons from the Tabler Project / MIT Licensed