File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -1111,6 +1111,21 @@ setting:
11111111 ;
11121112 };
11131113
1114+ It is also possible to define a service as public thanks to the ``#[Autoconfigure] ``
1115+ attribute. This attribute must be used directly on the class of the service
1116+ you want to configure::
1117+
1118+ // src/Service/PublicService.php
1119+ namespace App\Service;
1120+
1121+ use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
1122+
1123+ #[Autoconfigure(public: true)]
1124+ class PublicService
1125+ {
1126+ // ...
1127+ }
1128+
11141129.. _service-psr4-loader :
11151130
11161131Importing Many Services at once with resource
Original file line number Diff line number Diff line change @@ -62,6 +62,21 @@ You can also control the ``public`` option on a service-by-service basis:
6262 ->public();
6363 };
6464
65+ It is also possible to define a service as public thanks to the ``#[Autoconfigure] ``
66+ attribute. This attribute must be used directly on the class of the service
67+ you want to configure::
68+
69+ // src/Service/Foo.php
70+ namespace App\Service;
71+
72+ use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
73+
74+ #[Autoconfigure(public: true)]
75+ class Foo
76+ {
77+ // ...
78+ }
79+
6580.. _services-why-private :
6681
6782Private services are special because they allow the container to optimize whether
You can’t perform that action at this time.
0 commit comments