March 9, 2016 Javier Eguiluz

Service scopes control how long an instance of a service is used by the container. The DependencyInjection component provides three scopes:

container (the default one) where the same instance is used each time you ask for a service from the container;

(the default one) where the same instance is used each time you ask for a service from the container; prototype where a new instance is created each time you ask for the service;

where a new instance is created each time you ask for the service; request where a new instance is created for each subrequest (and it's unavailable outside the request).

The request_stack service, introduced in Symfony 2.4, solved the problems related to the request scope and dealing with the Request object in services. This made us rethink the entire "scope" concept and we decided to simplify the DependencyInjection component deprecating them entirely in Symfony 2.8 and removing them in Symfony 3.0.