Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Best practice notes for service naming. #392

merged 1 commit into from

2 participants


Hopefully this isn't too confusing -- feel free to revise as needed!


Was discussed on the ML, so good to go! Thanks

@Freeaqingme Freeaqingme merged commit f021ec2 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 12, 2012
  1. @demiankatz
This page is out of date. Refresh to see the latest.
7 docs/languages/en/modules/
@@ -29,4 +29,11 @@ When creating a ZF2 module, there are some best practices you should keep in min
module namespace with a vendor prefix. As an example, the (incomplete) developer tools module distributed by Zend
is named "ZendDeveloperTools" instead of simply "DeveloperTools".
+- **Utilize a module prefix for service names.** If you define services in the top-level Service Manager, you are
+ encouraged to prefix these services with the name of your module to avoid conflicts with other modules' services.
+ For example, the database adapter used by MyModule should be called "MyModule\DbAdapter" rather than simply
+ "DbAdapter." If you need to share a service with other modules, remember that the Service Manager "alias"
+ feature can be used in a merged configuration to override factories defined by individual modules. Ideally,
+ modules should define their own service dependencies, but aliases can be configured at the application level to
+ ensure that common services in individual modules all refer to the same instance.
Something went wrong with that request. Please try again.