Service Manager
Component ID
2402463
Component name
Service Manager
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Component created
Component changed
Component body
Service manager provides an UI to see list of available services in Drupal 8. It also provides list of alternative definition available for a particular services by checking the interface implemented by a service.
Why Service Manager?
- No way to see all the services in one place
- No way to know the available alternative implementation for a service
- No easy way to switch the service class without updating sites/default/services.yml
- Every override need to updated in sites/default/services.yml
How service manager solves the above problem
- UI to see all the services available
- Shows list of alternative implementations (not accurate as try to find classes implement the same interface)
- Not in place - But can add a option to switch class. This can be done
- Not in place - If we can import the services using yml file as mentioned in Symfony documention, we can generate the service file dynamically and all we need in sites/default/services.yml is just this:
# sites/default/services.yml imports: - { resource: "@Drupal/serivice_manager/Resources/config/services.yml" }
Obviously, we can add plugin/hook to modules to provide mandatory overrides.
