For instance you have a bundle, which generated by the symfony console. In this case in the DependencyInjection/Configuration.php you have to insert your configuration representation:
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('amazingservice');
$rootNode->children()
->scalarNode('url')->end()
->scalarNode('client_id')->end()
->scalarNode('client_secret')->end()
->end()
->end();
Basically in the DependencyInjection/AmazingserviceExtension.php you will see the following lines:
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
It is not enough for getting the configuration in the Srevices. You have to take it into the container.
$container->setParameter(
'amazingservice.config',
$config
);
In this case the config in the container, so if your Service getting the container as a constructor parameter:
base.amazingservice:
class: Base\AmazingBundle\Services\AmazingServices
arguments: [@service_container]
Then you can get the configuration in the service with the following code, where the configuration will be an associative array:
private $config;
public function __construct(Container $container){
$this->config = $container->getParameter('amazingservice.config');
}