Get a list of services programatically
You can get all services from the container by using the kernel method getCachedContainerDefinition():

$container = \Drupal::getContainer();
$kernel = $container-&gt;get('kernel');
$services = $kernel-&gt;getCachedContainerDefinition()['services'];
foreach ($services as $service_id =&gt; $value) {
  $service_definition = unserialize($value);
}


Now you can output a list, for example containing the service id and the class name in $service_definition['class'].