Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b7152f7

Browse files
committed
Updated the service naming conventions for modern Symfony apps
1 parent ec0865f commit b7152f7

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

contributing/code/standards.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,17 @@ Naming Conventions
229229
Service Naming Conventions
230230
~~~~~~~~~~~~~~~~~~~~~~~~~~
231231

232-
* A service name contains groups, separated by dots;
232+
* A service name must be the same as the fully qualified class name (FQCN) of
233+
its class (e.g. ``App\EventSubscriber\UserSubscriber``);
233234

234-
* The DI alias of the bundle is the first group (e.g. ``fos_user``);
235+
* If there are multiple services for the same class, use the FQCN for the main
236+
service and use lowercased and underscored names for the rest of services.
237+
Optionally divide them in groups separated with dots (e.g.
238+
``something.service_name``, ``fos_user.something.service_name``);
235239

236-
* Use lowercase letters for service and parameter names (except when referring
240+
* Use lowercase letters for parameter names (except when referring
237241
to environment variables with the ``%env(VARIABLE_NAME)%`` syntax);
238242

239-
* A group name uses the underscore notation;
240-
241243
* Add class aliases for public services (e.g. alias ``Symfony\Component\Something\ClassName``
242244
to ``something.service_name``).
243245

0 commit comments

Comments
 (0)