semaio / magento2-configimportexport
semaio/magento2-configimportexport
Import/Export core_config_data values in Magento 2
ConfigImportExport
This extension provides CLI commands for Magento 2 to import/export system configuration data.
Why this extension?
While Magento 2 offers the app:config:dump / app:config:import commands, they're limited to one environment and a little bit hard to manage, especially in CI/CD setups.
This extension supports managing configuration values for multiple environments (production, staging, etc.) out-of-the-box, defining and overwriting base configuration values in a specific environment. It also allows different file formats (e.g., YAML, JSON). In general, it makes that process a bit more streamlined and easier to manage, with the added benefit of generalization and cross-compatibility with other agencies/merchants using this.
Installation
Add the package to your composer.json
composer require semaio/magento2-configimportexport
Enable and install the module
php bin/magento module:enable Semaio_ConfigImportExport
php bin/magento setup:upgrade
Facts
- Supported Magento versions are 2.4.4+.
- Supported PHP versions are 8.1, 8.2, 8.3, and 8.4.
Functionality
This module is a work in progress and will be extended in the future with more functionality and support for other file formats.
File formats
This module currently supports the following file formats:
- YAML (default)
- JSON
See docs/file-formats.md for more information and examples.
Import config data
See docs/config-import.md for more information.
Export config data
See docs/config-export.md for more information.
Usage with Deployer
When using a push approach in CI/CD, the environment variables should be replaced on the runner and not on the initiating host or target host. For this, you can use this Deployer task to do this and import the config settings;
task('magento:config:set', function () {
$resolver = new \Semaio\ConfigImportExport\Model\Resolver\EnvironmentVariableResolver();
$glob = glob('config/store/**/*.yaml');
array_walk($glob, function ($file) use ($resolver) {
if (file_put_contents($tempFile = tempnam('/tmp', get('clientslug')), $resolver->resolveValue(file_get_contents($file)))) {
upload($tempFile, get('release_path') . '/' . $file);
}
});
run('{{bin/php}} {{release_path}}/bin/magento config:data:import {{release_path}}/config/store ' . get('environment'));
});
Support
If you encounter any problems or bugs, please create an issue on GitHub.
Contribution
Any contribution to the development of MageSetup is highly welcome. The best possibility to provide any code is to open a pull request on GitHub.
Licence
Open Software License (OSL 3.0)
Contributors
Thanks to all contributors who invested their valuable time to contribute to this module. Much appreciated!
Inspiration
This module is inspired by the awesome n98-magerun plugin "HarrisStreet ImpEx" by @SchumacherFM for Magento 1 which you can find here.
Copyright
(c) 2016-2022 semaio GmbH / Rouven Alexander Rieker
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.
[Unreleased]
- ...
[5.0.0] - 2026-05-29
Changed
- Drop support for PHP 7.x — minimum is now PHP 8.1
- Drop support for symfony/yaml 3.x, 4.x, and 5.x (all EOL) — constraint is now
^6.0|^7.0, resolves three low-severity Dependabot security advisories - Fix PHP 8.4 compatibility: add missing return types to console command
execute()andconfigure()methods (see #85) by @simonmaass
[4.4.0] - 2024-08-29
Changed
[4.3.0] - 2024-04-18
Added
- Support import for encrypted configuration values (see #74) by @Maksold
- Add support for keeping and not overwriting configuration values in specific environments (see #75) by @vpodorozh
[4.2.0] - 2023-09-29
Added
Changed
- Fix theme import behavior where theme names containing a dash could not be resolved (see #72) by @Morgy93
[4.1.0] - 2023-03-24
Added
Changed
[4.0.0] - 2023-01-19
Added
- Export: Specify export file path through a new command option, refactor export file name and file path logic by @bluec and @therouv
Changed
- Allow numbers in environment variables by @therouv
[3.10.1] - 2022-10-14
Changed
[3.10.0] - 2022-10-13
Added
- Interactive env var support for local environments by @peterjaap
- Option to delete config values by @DavidLambauer
[3.9.0] - 2022-09-29
Changed
- Added some validation checks for environment variables by @peterjaap
[3.8.0] - 2022-09-29
Added
- Added support and documentation for using environment variables by @peterjaap
Changed
- Added documentation for previously undocumented base feature by @peterjaap
[3.7.0] - 2022-08-17
Changed
- PHP 8.1 compatibility changes when using YAML export (handling of null values) @therouv
[3.6.0] - 2022-05-31
Changed
- Allow PHP 8.1 for Magento 2.4.4 compatibility @therouv
[3.5.1] - 2022-03-23
Changed
- Add compatibility to new
symfony/yamlreleases to fix config export command when using--hierarchical=yoption @therouv - Allow
symfony/yaml:^6.0@therouv
[3.5.0] - 2021-03-13
Added
Changed
- Use
\Magento\Framework\Console\CommandListInterfaceinstead of\Magento\Framework\Console\CommandList(#40) @therouv
[3.4.0] - 2020-12-21
Changed
- Update dependency version constraints @therouv
[3.3.1] - 2020-08-07
Changed
- Remove trailing comma for PHP 7.2 compatibility @therouv
[3.3.0] - 2020-08-06
Added
- Add
no-cacheoption to config import @therouv
Changed
- Add support for PHP 7.4 and Magento 2.4 (@DavidLambauer
- Improve docs and code style @therouv
| Version | Stability | QA Status | Released |
|---|---|---|---|
| 5.0.0 | stable | Fail | 2026-05-29 06:48:54 |
| 4.4.0 | stable | Not tested | 2024-08-28 23:02:58 |
| 4.3.0 | stable | Not tested | 2024-04-18 12:33:18 |
| 4.2.0 | stable | Not tested | 2023-09-29 11:23:28 |
| 4.1.0 | stable | Not tested | 2023-03-24 13:37:31 |
| 4.0.0 | stable | Not tested | 2023-01-19 20:55:40 |
| 3.10.1 | stable | Not tested | 2022-10-14 07:25:37 |
| 3.10.0 | stable | Not tested | 2022-10-13 09:03:24 |
| 3.9.0 | stable | Not tested | 2022-09-29 17:07:53 |
| 3.8.0 | stable | Not tested | 2022-09-29 09:04:59 |
| 3.7.0 | stable | Not tested | 2022-08-17 13:04:33 |
| 3.6.0 | stable | Not tested | 2022-05-31 14:24:58 |
| 3.5.1 | stable | Not tested | 2022-03-23 16:10:54 |
| 3.5.0 | stable | Not tested | 2021-03-13 18:14:29 |
| 3.4.0 | stable | Not tested | 2021-03-13 18:13:51 |
| 3.3.1 | stable | Not tested | 2020-08-07 14:39:25 |
| 3.3.0 | stable | Not tested | 2020-08-06 09:48:52 |
| 3.2.0 | stable | Not tested | 2020-04-02 19:30:08 |
| 3.1.0 | stable | Not tested | 2020-03-05 20:44:32 |
| 3.0.0 | stable | Not tested | 2017-11-27 14:59:22 |
| 2.2.2 | stable | Not tested | 2017-05-04 07:14:22 |
| 2.2.1 | stable | Not tested | 2017-04-17 23:13:44 |
| 2.2.0 | stable | Not tested | 2016-11-21 08:53:41 |
| 2.1.2 | stable | Not tested | 2016-10-24 13:04:42 |
| 2.1.1 | stable | Not tested | 2016-08-02 20:37:50 |
| 2.1.0 | stable | Not tested | 2016-07-31 19:46:39 |
| 2.0.0 | stable | Not tested | 2016-04-01 20:22:58 |
Requires 5
| Package | Constraint |
|---|---|
| php | ^8.1 |
| symfony/yaml | ^6.0|^7.0 |
| magento/module-config | * |
| magento/module-store | * |
| magento/framework | * |
Requires-dev 1
| Package | Constraint |
|---|---|
| phpunit/phpunit | * |
| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Pass | 0 | |
| PHPStan | Fail | 4 | 4 errors (level 4, ruleset: phpstan + bitexpert/phpstan-magento) |
| Cpd | Pass | 0 | |
| Security | Pass | 0 |
Turn an existing module into recurring revenue.
If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.