Container

Container

class Container implements ResettableContainerInterface

Container is a dependency injection container.

It gives access to object instances (services).

Services and parameters are simple key/pair stores.

Parameter and service keys are case insensitive.

A service id can contain lowercased letters, digits, underscores, and dots. Underscores are used to separate words, and dots to group services under namespaces:

  • request
  • mysql_session_storage
  • symfony.mysql_session_storage

A service can also be defined by creating a method named getXXXService(), where XXX is the camelized version of the id: