// composer.json
{
"require": {
"php": ">=8.3",
"ext-ctype": "*",
"ext-iconv": "*",
"babdev/pagerfanta-bundle": "^4.0", // v4.4.0
"doctrine/doctrine-bundle": "^2.7", // 2.11.1
"doctrine/doctrine-migrations-bundle": "^3.2", // 3.3.0
"doctrine/orm": "^2.12", // 2.17.3
"knplabs/knp-time-bundle": "^2.2", // v2.2.0
"pagerfanta/doctrine-orm-adapter": "^4.0", // v4.2.0
"pagerfanta/twig": "^4.0", // v4.2.0
"stof/doctrine-extensions-bundle": "^1.7", // v1.10.1
"symfony/asset": "7.0.*", // v7.0.0
"symfony/asset-mapper": "7.0.*", // v7.0.2
"symfony/console": "7.0.*", // v7.0.2
"symfony/dotenv": "7.0.*", // v7.0.2
"symfony/flex": "^2", // v2.4.3
"symfony/framework-bundle": "7.0.*", // v7.0.2
"symfony/http-client": "7.0.*", // v7.0.2
"symfony/messenger": "7.0.*", // v7.0.1
"symfony/monolog-bundle": "^3.0", // v3.10.0
"symfony/runtime": "7.0.*", // v7.0.0
"symfony/scheduler": "7.0.*", // v7.0.0
"symfony/twig-bundle": "7.0.*", // v7.0.0
"symfony/ux-turbo": "^2.0", // v2.13.2
"symfony/yaml": "7.0.*", // v7.0.0
"twig/extra-bundle": "^2.12|^3.0", // v3.8.0
"twig/twig": "^2.12|^3.0" // v3.8.0
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.4", // 3.5.1
"symfony/debug-bundle": "7.0.*", // v7.0.0
"symfony/maker-bundle": "^1.41", // v1.52.0
"symfony/stopwatch": "7.0.*", // v7.0.0
"symfony/web-profiler-bundle": "7.0.*", // v7.0.2
"zenstruck/foundry": "^1.21" // v1.36.1
}
}
2 Comments
Great stuff.
Do any of the service attributes tags apply to services inside of bundles? That is, is there a way to use attributes instead of putting these kind of commands in the Bundle definition?
Hey Tac,
Yeah, seems you can replace that config with new PHP attributes provided by Symfony. However, note that to use attributes, you must use at least Symfony version 5.3 IIRC:
autowire()method can be replaced by using the#[Autowire]attribute in the service's class.addTag()method specific forcontroller.service_argumentscan be replaced by using#[AsController]attribute.setArgument()method can't be replaced directly by an Attribute but Symfony will auto-inject services if you type hint the dependencies in the controller constructor, or you can use#[Autowire]attribute for specific methods or properties.setAutoconfiguredfunction at all.Services are not "public" by default anymore though. Controllers, event subscribers, command handlers, Twig extensions, etc. are all public by default.
All other services are private by default. To make a service public, in Symfony you still need to use the configuration file I think.
Also, you may want to check this docs for more info about the available PHP attrs: https://symfony.com/doc/current/reference/attributes.html
I hope this helps!
Cheers!
"Houston: no signs of life"
Start the conversation!