PHP code example of space48 / magento2-environment-configuration

1. Go to this page and download the library: Download space48/magento2-environment-configuration 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/ */

    

space48 / magento2-environment-configuration example snippets




use Space48\EnvironmentConfiguration\ConfigValue;
use Space48\EnvironmentConfiguration\ConfigValueSet;
use Space48\EnvironmentConfiguration\Environment;
use Space48\EnvironmentConfiguration\EnvironmentConfigValues;
use Space48\EnvironmentConfiguration\Scope;

return EnvironmentConfigValues::create()
    ->withConfigValuesForEnvironment(
        $values = ConfigValueSet::of([
            new ConfigValue('example/config/path', 'example config value')
        ]),
        $environment = Environment::LOCAL)
    ->withConfigValuesForEnvironment(
        $values = ConfigValueSet::of([
            (new ConfigValue('example/config/path', 'example website specific value'))
                ->withScope(
                    new Scope('websites', 3)
                )
        ]),
        $environment = Environment::PRODUCTION);
sh
composer gento module:enable Space48_EnvironmentConfiguration
sh
php bin/magento environment-configuration:apply local|development|staging|production