Magento 2 Store Configuration Setup
Open Issues: 0
- php: ~7.1.3||~7.2.0
- magento/framework: 101.0.*||102.0.*
- magento/module-config: 101.0.*||~101.1.0
- magento/module-store: 100.2.*||101.0.*
- symfony/console: ~2.3||~4.1.0
- zendframework/zend-code: ~3.1
This package is auto-updated.
Last update: 2023-05-08 10:11:43 UTC
composer install alaa/magento2-store-config php -f bin/magento module:enable Alaa_StoreConfig php -f bin/magento setup:upgrade
How it works
Dumping the data
you would first run the following command:
php -f bin/magento store-config:dump
The above command will dump the data in the
core_config_data table to the config files. The data will be broken into the following sections:
- The folder
- Deploy mode
developerresulting in paths
- Scopes which will be resulting into:
- Then into default, store-code and website-code such as:
Sensitive Data will not be dumped as setting sensitive data should not be done via version control - click here to find out more about sensitive configurations.
php -f bin/magento store-config:dump will dump the data initially so development can start from that point. Then configurations can be added as needed and thus these configurations can be shared among the team to keep the same configuration across local environments.
The breakdown into development and production modes will help keep the configurations separate in case configurations in production vary from the development environment.
You have to be in production mode to generate configs for the production, however you can create them manually to
Sample configuration file:
<?php declare(strict_types=1); return [ [ 'path' => 'web/seo/use_rewrites', 'value' => '1', ], [ 'path' => 'general/locale/code', 'value' => 'en_GB', ], ];
The configurations for production mode will sit inside
production configurations need to be manually added if you are in developer mode.
Checking the data
Once more configurations are added to the files, they can be checked by the following command:
php -f bin/magento store-config:check
The above will check the files for any missing arguments which are mainly the
path and the
Any sensitive data will be flagged out and will advise to remove them from the configuration files.
Once check is done, add these files to
Running the configuration
php -f bin/magento store-config:configure
The above command will write the configurations from the files to the
The configuration will be written based on the deploy mode.
The above command is safe to run as many times.
The Recurring Script
The recurring script will write the configurations to the
The configurations are deploy mode based.
The module can be configured from the admin:
- Enable/Disable the module functionality
- Enable/Disable loggers (file and/or console loggers)
- Enable/Disable the Recurring scripts
Feel free to raise issues and contribute.