use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; $containerBuilder = new ContainerBuilder(); $definition = new Definition('MyClass'); $definition->addArgument('some value'); $containerBuilder->setDefinition('my_service', $definition);
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; $containerBuilder = new ContainerBuilder(); $extension = new MyExtension(); $containerBuilder->registerExtension($extension);
use Symfony\Component\DependencyInjection\ContainerBuilder; $containerBuilder = new ContainerBuilder(); // Define and register services and extensions... $containerBuilder->compile();The Symfony\Component\DependencyInjection\ContainerBuilder is part of the DependencyInjection component of the Symfony framework, which provides tools for managing service containers and injecting dependencies into objects.