title: Custom YAML configuration file in Symfony 4
body: <p>I'm trying to create a custom configuration file outside of <code>config/packages</code>, as I need this file to be writable. I understand that Symfony 4 does not define an AppBundle like previous versions. I've seen similar issues with solutions that does not work for my specific case.</p>
  
  <p>So far I have created the following files:</p>
  
  <pre><code># config/settings.yaml
  
  settings:
      foo: 3
  </code></pre>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App\DependencyInjection;
  
  use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  use Symfony\Component\Config\Definition\ConfigurationInterface;
  
  class Configuration implements ConfigurationInterface
  {
      public function getConfigTreeBuilder()
      {
          $tree_builder = new TreeBuilder();
          $root_node = $tree_builder-&gt;root('settings');
  
          $root_node
              -&gt;addDefaultsIfNotSet()
              -&gt;children()
                  -&gt;scalarNode('foo')
                      -&gt;defaultValue(1)
                  -&gt;end()
              -&gt;end()
          ;
  
          return $tree_builder;
      }
  }
  </code></pre>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App\DependencyInjection;
  
  use Symfony\Component\Config\FileLocator;
  use Symfony\Component\DependencyInjection\ContainerBuilder;
  use Symfony\Component\DependencyInjection\Loader;
  use Symfony\Component\HttpKernel\DependencyInjection\Extension;
  
  class SettingsExtension extends Extension
  {
      public function load(array $configs, ContainerBuilder $container)
      {
          $configuration = new Configuration();
          $config = $this-&gt;processConfiguration($configuration, $configs);
  
          $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../../config'));
          $loader-&gt;load('settings.yaml');
  
          $container-&gt;setParameter('settings.foo', $config['foo']);
      }
  }
  </code></pre>
  
  <p>And I've loaded the extension in <code>Kernel.php</code> as:</p>
  
  <pre class="lang-php prettyprint-override"><code>
      protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
      {
          $container-&gt;registerExtension(new SettingsExtension());
          $container-&gt;loadFromExtension('settings');
  
          ...
      }
  
  </code></pre>
  
  <p>But if get the following error:</p>
  
  <pre><code>There is no extension able to load the configuration for "settings" (in src/DependencyInjection/../../config/settings.yaml). Looked for namespace "settings", found none
  </code></pre>