symfony Service Container


Introduction

A Symfony application is typically composed of a lot of objects that perform different tasks, such as repositories, controllers, mailers, etc. In Symfony, these objects are called services, and are defined in app/config/services.yml or in one of the installed bundles.

The Service Container knows how to instantiate these services, and keeps a reference of them so they don't have to be instantiated twice. If a service has dependencies it will instantiate those too.