2017 © Pedro Peláez
 

magento2-module config-manager

Hammer Config Manager

image

hammer/config-manager

Hammer Config Manager

  • Wednesday, March 21, 2018
  • by federivo
  • Repository
  • 3 Watchers
  • 0 Stars
  • 70 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 17 % Grown

The README.md

Hammer Config Manager

How to install?

Install using composer

  1. composer require hammer/config-manager:dev-master
  2. Enable the module: bin/magento module:enable Hammer_ConfigManager
  3. bin/magento setup:upgrade

How to use it?

Set the environment you are working on (example: local, dev, stage, preprod, prod) using the following command, (*1)

bin/magento hammer:environment:set [local, dev, stage, preprod, prod], (*2)

This one create a new entry to env.php (app/etc/env.php), (*3)

'hammer_environment' => 'local', (*4)

that it's used by the Config Manager in order to know where to find the correct file with the information that correspond to each environment. Local configuration should be a config file in app/etc/custom_config/local/config.json, (*5)

For other environments (dev, stage, preprod and prod) the file should be located in app/etc/custom_config/config.json., (*6)

All these files contains the data for the values that change in each environment., (*7)

For example:, (*8)

{
  "Hammer_PaymentSetup::paypal/wpp/api_username": "direct-facilitator_api1.testmerchant.com",
  "Hammer_PaymentSetup::paypal/wpp/api_password": "FOCQ5TD5JRNH8TDG",
  "Hammer_PaymentSetup::paypal/wpp/api_signature": "AFcWxV21C7fe9m3bPOFHRpSSRl31AOsbMi0t56rdj7bZ7m9EkAVQQ1gr",
  "Hammer_PaymentSetup::paypal/wpp/sandbox_flag": 1
}

To use this we should inject the dependencies like, (*9)

public function __construct(
    EncryptorInterface $encryptor,
    Config $config,
    \Hammer\ConfigManager\Helper\ConfigManager $configManager)
    {
    //var initialization
}

after that we will be able to get the value like so:, (*10)

$sandboxFlag = $this->configManager->getProperty('Hammer_PaymentSetup::paypal/wpp/sandbox_flag');, (*11)

The Versions

21/03 2018

dev-master

9999999-dev

Hammer Config Manager

  Sources   Download

MIT

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0|~7.1.0|~7.2.0