PHPackages                             hashbangcode/config\_split\_merge - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hashbangcode/config\_split\_merge

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hashbangcode/config\_split\_merge
=================================

Merges configuration directories into a single structure.

1.1.1(7y ago)1032GPL-2.0-or-laterPHP

Since Dec 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/hashbangcode/config_split_merge)[ Packagist](https://packagist.org/packages/hashbangcode/config_split_merge)[ RSS](/packages/hashbangcode-config-split-merge/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (5)Dependencies (3)Versions (7)Used By (0)

Config Split Merge
==================

[](#config-split-merge)

A tool to merge together separate configurations for Drupal 8 sites.

Taking a primary configuration this tool will analyse the configuration available and perform the following actions.

- If the configuration exists in the primary and not in the secondary then leave it alone and add it to the primary config split blacklist.
- If the configuration exists in both sites and there is no difference between the two sites then the configuration is placed into a default configuration area.
- If the configuration exists in both sites and that configuration is different then add this configuration to the configuration split grey list for both sites and make a copy in the default configuration.
- If the configuration exists in both sites, contains a single difference, and that difference is just the uuid, then copy the primary configuration to the default configuration area and delete the sibling configuration file. This step also generates output in the form of a update hook that can be used to update the uuid for all sites.

The tool doesn't understand Drupal configuration, just the YAML structure that it contains.

Install
-------

[](#install)

Just install the tool using composer into your Drupal codebase.

```
composer require --dev hashbangcode/config_split_merge

```

Once you have used it you can then remove the tool from your site.

```
composer remove --dev hashbangcode/config_split_merge

```

The tool is a one-shot deal and should only be used when you have problems with your config in a multi-site setup.

Setup
-----

[](#setup)

You first need to ensure that the configuration split config files have been created for the configurations you want to merge. You don't need to install the configuration splits on all sites, but the config files need to exist.

The tool needs minimal setup, you just need to ensure that the configuration directory structure looks something like this.

```
/config/default
/config/default/config_split.config_split.parent.yml
/config/default/config_split.config_split.child1.yml
/config/default/config_split.config_split.child2.yml
/config/parent
/config/child1
/config/child2

```

You can alter the location of the 'default' directory by passing the --config flag with a value of the directory.

Usage
-----

[](#usage)

**NOTE**: This tool will alter the config directories *in-situ*, i.e. it will permanently alter your config directories. Make sure you have adequate backups before hand!

Run the tool by passing the parent and child directories that need analysis.

```
./vendor/bin/config_split_merge drupal:config_split_merge parent child

```

You can provide multiple child directories by separating them with a comma.

```
./vendor/bin/config_split_merge drupal:config_split_merge parent child1,child2

```

By default the configuration area is assumed to be located at 'config', relative to the other two directories. You can set this location by passing in the --config flag.

```
./vendor/bin/config_split_merge drupal:config_split_merge parent child --config=sync/config

```

If applicable, the tool will also output the result of any config that is shared between sites, but that needs to be altered in the database before it can be used on one of the sites. This is in the form of an update hook that can be added to the install profile or module of your choice. This update should be run on all sites.

```
