This is the first article in a series showcasing the most important new features
introduced by Symfony 7.4, which will be released at the end of November 2025.
Symfony has supported three different configuration formats since day one: PHP,
YAML, and XML. All formats provide nearly identical capabilities and equivalent
performance because they are compiled back to PHP before runtime.
In recent Symfony versions, XML support was disabled by default for packages and
routes. To re-enable it, you had to update the configureContainer() and/or
configureRoutes() methods in the src/Kernel.php file.
In Symfony 7.4, XML configuration is officially deprecated, and starting with
Symfony 8.0, it will no longer be supported. YAML will remain the default format
used by Symfony and by the Symfony recipes, but you can also use PHP if you
prefer a fully code-based configuration.
For reusable Symfony bundles, XML remains a popular format since it was the
officially recommended option for many years. You can use the XML config to PHP tool
to automatically convert your bundle’s XML configuration to PHP.
Alongside this deprecation, Symfony 7.4 enhances the remaining formats with
important new features.
Better YAML Autocompletion
JSON schemas describe the structure, constraints, and data types of JSON
documents and JSON-compatible formats such as YAML. Combined with a schema-aware
editor or validator (like the ones built into modern IDEs such as PHPStorm) they
enable real-time validation and autocompletion.
In Symfony 7.4, new schemas are available for services and routes configuration,
as well as for validation and serialization metadata. That’s why updated
Symfony recipes now include the following $schema: line at the top of YAML
files to declare the corresponding schema:
# config/services.yaml
# yaml-language-server: $schema=../vendor/symfony/dependency-injection/Loader/schema/services.schema.json
parameters:
# ...
services:
# ...
# config/routes.yaml
# yaml-language-server: $schema=../vendor/symfony/routing/Loader/schema/routing.schema.json
controllers:
# ...
PHP Array Shapes
We’re also exploring new ways to make PHP configuration more expressive. In
Symfony 7.4, we’re introducing advanced array shapes, which allow you to
configure your application using structures similar to YAML but written in pure PHP.
This lets you define routes in PHP like this:
// config/routes.php
namespace SymfonyConfig;
return new RoutesConfig([
'route1_name' => ['path' => '/path1'],
'when@dev' => [
'route2_name' => ['path' => '/path2'],
],
]);
And define configuration as follows:
// config/packages/framework.php
namespace SymfonyConfig;
return new FrameworkConfig([
'secret' => env('APP_SECRET'),
'esi' => true,
'session' => [
'handler_id' => null,
'cookie_secure' => 'auto',
'cookie_samesite' => 'lax',
],
]);
These array shapes can be leveraged by static analyzers and IDEs for better
insight and autocompletion, although the exact experience will depend on your editor.



