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.


Mathieu Lechat
Contributed by Mathieu Lechat in #60568

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

Nicolas Grekas
Contributed by Nicolas Grekas in #61282 and #61564

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:

1
2
3
4
5
6
7
8
9
10
11
12
13
# 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

Nicolas Grekas
Contributed by Nicolas Grekas in #61490 , #61885 and #61894

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:

1
2
3
4
5
6
7
8
9
// config/routes.php
namespace Symfony\Config;

return new RoutesConfig([
    'route1_name' => ['path' => '/path1'],
    'when@dev' => [
        'route2_name' => ['path' => '/path2'],
    ],
]);

And define configuration as follows:

1
2
3
4
5
6
7
8
9
10
11
12
// config/packages/framework.php
namespace Symfony\Config;

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.

Published in #Living on the edge