The Symphony\Component\DependencyInjection\ContainerBuilder class is used to build a dependency injection container. One of its methods is getServiceIds(), which returns an array of all the service IDs that have been registered with the container.
Example 1:
$container = new ContainerBuilder(); // register services... $serviceIds = $container->getServiceIds(); // returns an array of all the registered service IDs
In this example, we create a new container builder and register some services with it. We then call the getServiceIds() method to get an array of all the registered service IDs.
Example 2:
use Symfony\Component\DependencyInjection\ContainerBuilder; use Acme\Bundle\MyBundle\DependencyInjection\MyBundleExtension; $container = new ContainerBuilder(); $extension = new MyBundleExtension(); $extension->load([], $container); $serviceIds = $container->getServiceIds();
In this example, we use the MyBundleExtension to load services into the container. We then call the getServiceIds() method to get an array of all the registered service IDs.
Both examples use the Symfony\Component\DependencyInjection package, which is a popular package library for implementing dependency injection in PHP projects.
PHP Symfony\Component\DependencyInjection ContainerBuilder::getServiceIds - 30 examples found. These are the top rated real world PHP examples of Symfony\Component\DependencyInjection\ContainerBuilder::getServiceIds extracted from open source projects. You can rate examples to help us improve the quality of examples.