PHP code example of rstgroup / zf-external-config-module

1. Go to this page and download the library: Download rstgroup/zf-external-config-module 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/ */

    

rstgroup / zf-external-config-module example snippets


return [
    'modules' => [
        (...),
        'RstGroup\ZfExternalConfigModule',
    ],
    (...)
]

return [
    'rst_group' => [
        'external_config' => [
            'providers' => [
                'YourProviderService' => true,
            ],
            'service_manager' => [
                'factories' => [
                    'YourProviderService' => YourProvidersServiceFactory::class
                ]
            ]
        ],
    ]
];

rst_group.external_config.providers

return [
    'rst_group' => [
        'external_config' => [
            'providers' => [
                
                'EnabledProvider#1' => true,
                'EnabledProvider#2' => 'true',
                'EnabledProvider#3' => 'on',
                'EnabledProvider#4' => 1,
                
                'DisabledProvider#1' => false,
                'DisabledProvider#2' => 'false',
                'DisabledProvider#3' => 'off',
                'DisabledProvider#4' => 0,
                
            ],
        ],
    ],
];

use Psr\Container\ContainerInterface;
use \RstGroup\ZfExternalConfigModule\Config\ExternalConfigListener;

final class ExampleServiceFactory {
    public function __invoke(ContainerInterface $container) {
        /* getting app's configuration */
        $appConfig = $container->get(
            ExternalConfigListener::SERVICE_APPLICATION_CONFIG
        );
        
        /* getting zf-external-config-module configuration */
        $moduleConfig = $container->get(
            ExternalConfigListener::SERVICE_EXTERNALS_CONFIG
        );
        
        (...)
    }
}