use Symfony\Component\DependencyInjection\ContainerBuilder; $container = new ContainerBuilder(); $container->register('my_service', MyService::class); $myService = $container->get('my_service');
$myServiceDescription = $container->describe('my_service'); print_r($myServiceDescription);This code will print out the description of the `my_service` service, including its class, arguments, and tags. In summary, the Symfony\Component\DependencyInjection\ContainerBuilder class is a package library that provides dependency injection functionality in PHP applications. It enables the creation of a container that manages the instantiation and configuration of objects and their dependencies. It comes with many methods for registering, retrieving, and describing services, which makes it a powerful tool for building flexible and extensible applications.