PHP code example of makertim / multisite-env-switcher

1. Go to this page and download the library: Download makertim/multisite-env-switcher library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

makertim / multisite-env-switcher example snippets


\MakerTim\MultisiteEnvSwitcher\MultisiteEnvSwitcher::load();


...

\MakerTim\MultisiteEnvSwitcher\MultisiteEnvSwitcher::load();

...

$dotenv = \Dotenv\Dotenv::createUnsafeMutable(dirname(__DIR__));
$dotenv->load();

\MakerTim\MultisiteEnvSwitcher\MultisiteEnvSwitcher::load();

$dotenv->

MultisiteEnvSwitcher::load('beta.example.com');

$site = getenv('SITE');
json
{
  ...
  "autoload": {
    "files": [
      "src/autoload.env.php"
    ]
  },
  ...
}
bash
APP_SITES="ALPHA BETA"
APP_SITE_DOMAIN__ALPHA='(www\.)?alpha\.(test|example\.com)'
APP_SITE_DOMAIN__BETA='beta\.example\.com'