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 @@ -1115,6 +1115,21 @@ setting:
11151115 ;
11161116 };
11171117
1118+ It is also possible to define a service as public thanks to the ``#[Autoconfigure] ``
1119+ attribute. This attribute must be used directly on the class of the service
1120+ you want to configure::
1121+
1122+ // src/Service/PublicService.php
1123+ namespace App\Service;
1124+
1125+ use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
1126+
1127+ #[Autoconfigure(public: true)]
1128+ class PublicService
1129+ {
1130+ // ...
1131+ }
1132+
11181133.. _service-psr4-loader :
11191134
11201135Importing 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