use Symfony\Component\DependencyInjection\Definition; $container->setDefinition('my_service', new Definition()) ->setClass('App\Service\MyService');
use Symfony\Component\DependencyInjection\Definition; $container->setDefinition('my_service', new Definition()) ->setClass('App\Service\MyService') ->setArguments([ '%parameter_name%', '@another_service', 123 ]);In this example, we are setting both the class and constructor arguments for the 'my_service' service definition. The first argument is a parameter named 'parameter_name', the second argument is another service with the id 'another_service', and the third argument is the integer value 123. Package/Library: Symfony\Component\DependencyInjection.