PHP code example of bartlomiejbeta / di-env-loader-bundle

1. Go to this page and download the library: Download bartlomiejbeta/di-env-loader-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bartlomiejbeta / di-env-loader-bundle example snippets


class ExampleExtension extends Extension
{
  use DIEnvLoaderTrait;

  public function load(array $configs, ContainerBuilder $container)
  {
    $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
    
    self::loadByEnv($loader, $container, 'services', 'yml');
  }

}

class ExampleExtension extends Extension
{
  use DIEnvLoaderTrait;

  public function load(array $configs, ContainerBuilder $container)
  {
    $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config/test'));
    
    if ('test' === self::getEnv($container))
    {
      self::loadByEnv($loader, $container, 'services', 'yml', '.');
    }
  }

}