Download the PHP package zooxsmart/los-domain without Composer
On this page you can find all versions of the php package zooxsmart/los-domain. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zooxsmart/los-domain
More information about zooxsmart/los-domain
Files in zooxsmart/los-domain
Package los-domain
Short Description Middleware for use php configuration based on domain or subdomain
License MIT
Homepage https://github.com/zooxsmart/los-domain
Informations about the package los-domain
LosDomain
Introduction
This module provides php configuration files based on the domain (or subdomain) being accessed.
For Zend Framework 2/3 framework.zend.com, please use version 1.0.
Todo
Todo
- Option to manually disable a domain, redirecting it to a page. (eg. expired subscription)
- Integration with LosLicense (in development) to check the availibity of a domain and automatically disable it.
- Storages to retrieve options for domains (interface, file, pdo, so on)
Instalation
Usage
For example, in Zend Expressive, add the following code to your config/config.php:
Because the included files cannot be cached, it's better to include the code after the cache read/write. So a complete config.php will looks like:
The service will look into the folder 'config/autoload/domains' for your domains. If there is a folder named identically as your domain, it will be imported.
For example, assume these domains:
- test.local
- client1.test.local
- client2.test.local
- www.test.local
Each domain (or subdomain) can have a different configuration (factories, database configurations, so on):
- config/autoload/domains/test.local/domain.global.php
- config/autoload/domains/client1.test.local/domain.global.php
- config/autoload/domains/www.test.local/domain.global.php
- config/autoload/domains/www.test.local/domain.local.php
Since the client2.test.local does not have it's configuration, it will use the default from the project.
Domain Alias
It's possible to assign an alias to a domain. Supose you have two domains that share the same configuration:
- test.local
- www.test.local
The first one you create as usual (creating the config files inside ) and the alias is configured in a file
With this configuration, when the project is access through 'www.test.local', the service will load the 'test.local' files.