Understanding dependency injection container
A dependency injection container is an object that knows how to auto-wire classes together. The auto-wire term implies both instantiating and properly configuring objects. This is by no means an easy task, which is why there are several libraries addressing this functionality.
The DependencyInjection component provided by the Symfony framework is a neat dependency injection container that can be easily installed by Composer.
Moving forward, let's go ahead and create a di-container directory where we will execute these commands and set up our project:
composer require symfony/dependency-injectionThe resulting output suggests we should install some additional packages:

We need to make sure we add the symfony/yaml and symfony/config packages by running the following console commands:
composer require symfony/yaml
composer require symfony/configThe symfony/yaml package installs the Symfony Yaml component. This component parses the YAML strings into PHP...