Download the PHP package drunomics/multisite-request-matcher without Composer

On this page you can find all versions of the php package drunomics/multisite-request-matcher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package multisite-request-matcher

Multisite Request Matcher

Matches requests to multisites based upon configuration driven by environment variables. The packages works well with symfony/dotenv and symfony/http-foundation as used by drupal/core.

The multisite setup supports configuration via a common base-domain ($APP_MULTISITE_DOMAIN) or via per site domains. Via environment-dependent variables the common base-domain may be enabled for preview environments only also. The configured default site is used when the common multisite base-domain is accessed without any suiting prefix. Next, it's used for CLI invocations if no SITE variable is given a.

Installation

composer require drunomics/multisite-request-matcher

Configuration

The package support construction site URLs via via a common base-domain ($APP_MULTISITE_DOMAIN) or via per site domains. Optional, site variants like "admin" or "api" are supported - useful if the app uses multiple hosts for things like the admin interface or an API endpoint.

That can be used to construct URLs like the following:

The following environment variables may be set to configure the request matcher:

Variable name Required Example Value Description
TRUSTED_PROXIES No 127.0.0.1 A list of IP addresses or subnets, separated by space.
HEADER_FORWARDED_HOST No X_FORWARDED_HOST A non-standard value for the host header.
APP_SITES Yes site-a site-b The list of site names, separated by space. May contain lowercase characters and dashes only.
APP_DEFAULT_SITE No site-a The default site to set. If not set, the first set will be set by default.
APP_SITE_VARIANTS No admin api An optional list of variants; i.e. variants of the same site.
APP_SITE_VARIANT_SEPARATOR No -- The separator between the variant name and the host, defaults to "--".
APP_MULTISITE_DOMAIN ~ stage.codebase.dev A common base domain for all sites. Required when multisite base domains should be used.
APP_MULTISITE_DOMAIN_PREFIX_SEPARATOR No _ The separator between the site name and the common multisite base domain. Defaults to '_'.
APP_SITE_DOMAIN__{{ SITE }} ~ site-a.com The per-site domain - required when per-site domains should be used. One variable per site must be provided with dashes replaced to underscores, e.g. for site-a the variable name would be APP_SITE_DOMAIN__site_a
APP_SITE_DOMAIN_ALIASES__{{ SITE }} No site-a.hoster.com,site-a.hoster.com Comma separated, per-site domain aliases that are allowed in addition to the main domain. Useful when access should be allowed via some non-primary domains also; e.g., when behind a CDN. One variable per site must be provided with dashes replaced to underscores, e.g. for site-a the variable name would be APP_SITE_DOMAIN_ALIASES__site_a
APP_SITE_DOMAIN ~ site-a.com If an environment is bound to a fixed site, the site's domain. Requires SITE to be predefined.
APP_SITE_DOMAIN_ALIASES No site-a.host.com,site-a.host2.com If an environment is bound to a fixed site, the site's domain aliases (see above). Requires SITE to be predefined.

Results

Variable name Example Value Description
SITE site-a The active site.
SITE_VARIANT api The active site variant. Empty if no variant is active.
SITE_HOST api--site-b_stage.example.com The site's full host for the active site and variant.
SITE_MAIN_HOST stage.example.com The site's main host, without any variant.

CLI invocations

In order to make the same environment variables available for CLI invocations, the package provides the binary request-matcher-site-variables which outputs them based upon the set $SITE variable. Site variants are not supported in CLI requests, thus SITE_VARIANT is is always empty.

Usage with Drupal

Credits

developed by drunomics GmbH, [email protected] Please refer to the commit log individual contributors.


All versions of multisite-request-matcher with dependencies

PHP Build Version
Package Version
Requires symfony/http-foundation Version ^4.4.9 || ^6.2.7
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package drunomics/multisite-request-matcher contains the following files

Loading the files please wait ....