The composer.json file in https://github.com/symfony/skeleton/blob/6.4/composer.json contains the property
"flex-require": {
"symfony/console": "*",
"symfony/dotenv": "*",
"symfony/framework-bundle": "*",
"symfony/runtime": "*",
"symfony/yaml": "*"
},
What does flex-require
do? I cannot find it documented anywhere.
flex-require
is leveraged by the Symfony Flex Plugin.
Simply put, whatever is on flex-require
will be merged into the regular require
section composer.json
.
This is solely used for new installations of new project templates (create-project
). There, the basic require
only bare platform necessities. In the example you linked:
{
"require": {
"php": ">=8.1",
"ext-ctype": "*",
"ext-iconv": "*",
"symfony/flex": "^2"
}
}
So this basically tells composer to check for PHP version and a couple of extensions, and then to install Flex.
From there Flex will take over, merge the flex-require
and flex-require-dev
keys (if present), and continue the installation.
I imagine it is not documented because it's only used for the framework distribution, and it's not generally useful for library developers (although nothing stops you from leveraging the Flex plugin for your own distribution uses).