use Symfony\Component\DependencyInjection\ContainerBuilder; $containerBuilder = new ContainerBuilder(); $containerBuilder->setParameter('my_parameter', 'example_value'); // ... $containerBuilder->compile();
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; $containerBuilder = new ContainerBuilder(); $containerBuilder->register('my_service', 'My\Service') ->setArgument(0, 'example_value') ->setArgument(1, new Reference('other_service')); // ... $containerBuilder->compile();In this example, the `setArgument` method is used to set a value to an argument in the service definition. The first argument is set to a string value, while the second argument is set to a reference to a different service within the container. Package library: Symfony Dependency Injection component.