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:
1115
1115
;
1116
1116
};
1117
1117
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
+
1118
1133
.. _service-psr4-loader :
1119
1134
1120
1135
Importing 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:
62
62
->public();
63
63
};
64
64
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
+
65
80
.. _services-why-private :
66
81
67
82
Private services are special because they allow the container to optimize whether
You can’t perform that action at this time.
0 commit comments