Multisite Matcher

Component ID

2359341

Component name

Multisite Matcher

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

1509

Component created

Component changed

Component body

Sitematcher is not literally a Drupal module, but a handy API tool for Drupal multisite environments. It aims to reduce non-versioned and also copy & paste overhead at bootstrap level by replacing file- and folder-based configuration with configuration arrays. This reduces the common side effects of repeated code,
and also allows for versioning most of your bootstrap-level configuration files without revealing secrets (like database configuration).

Sitematcher also facilitates multi-environment deployment (e. g. dedicated settings for production, staging and development), with again no duplicate code/config at any point (except for "known issues" below).

Make your multisite setups more maintainable

This project has been inspired by an interesting blog post on multisite best practice. It deals with organizing and automatting a multisite setup, especially in variying environments where more than one (virtual) host, database, setting or configuration needs to be applied and depends on the request's host name (like the legacy sites.php approach does).

Instead of maintaining copy & paste include collections (sites/*/settings.php, sites.php etc.) for each of your probably dozens of sites, sitematcher's basic idea is similar to (S)CSS, group policies or other cascading and object-oriented structures: Every definition once, in one place, with "parent properties" and "child mixins".

Based on regex conditions matched against the actual hostname from the current request, all settings are generated on demand and added to the global settings.

Features

  • Eliminates repeating code/config at bootstrap level.
  • Dynamic generation of $sites, $settings, $conf and any other global variable from atomic, unique and re-usable configuration code includes.
  • Regex based hostname-to-siteID matching (to replace or extend hard-coded sites.php entries).
  • NEW: Regex based blacklisting ('!regex' definitions)
  • Facilitates and improves versioning of multisite setups.
  • Helps separating configuration from auth (e. g. DB credentials from technical DB details).
  • Unlimited nesting and sharing of config includes (similar to CSS or other cascading approaches).

Documentation

Aside of the README file, now also an online documentation exists (still work in progress).

Credits and professional support

Sponsored by and part of a project for HiRN GmbH. We will also be glad to professionally support you in solving your integration issues.