PHPackages                             los/losdomain - 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. los/losdomain

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

los/losdomain
=============

Middleware for use php configuration based on domain or subdomain

2.2.0(4y ago)535.6k3[1 issues](https://github.com/Lansoweb/LosDomain/issues)MITPHPPHP ~7.4.0||~8.0.0||~8.1.0

Since Dec 26Pushed 4y ago2 watchersCompare

[ Source](https://github.com/Lansoweb/LosDomain)[ Packagist](https://packagist.org/packages/los/losdomain)[ Docs](http://github.com/Lansoweb/LosDomain)[ RSS](/packages/los-losdomain/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (11)Used By (0)

LosDomain
=========

[](#losdomain)

[![Build Status](https://camo.githubusercontent.com/45ef40c4e6dd688211e205cb92cda46c5ad4758b105424993c5ff3738f67c043/68747470733a2f2f7472617669732d63692e6f72672f4c616e736f7765622f4c6f73446f6d61696e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Lansoweb/LosDomain) [![Latest Stable Version](https://camo.githubusercontent.com/d52922c7ef392844609e1a4a0de42fc21d2b7cf474cb976f1f2fdbc534668fa6/68747470733a2f2f706f7365722e707567782e6f72672f6c6f732f6c6f73646f6d61696e2f762f737461626c652e737667)](https://packagist.org/packages/los/losdomain) [![Total Downloads](https://camo.githubusercontent.com/bf0d1a7bc806444ec395ec4ae425fa8be49d48f81f235fd13caa95f539d0ff02/68747470733a2f2f706f7365722e707567782e6f72672f6c6f732f6c6f73646f6d61696e2f646f776e6c6f6164732e737667)](https://packagist.org/packages/los/losdomain) [![Coverage Status](https://camo.githubusercontent.com/2045396f34a58b58efca6e530a6ef09a83aaf0c6f4c6b0f12b618121560b5e59/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f4c616e736f7765622f4c6f73446f6d61696e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/Lansoweb/LosDomain?branch=master) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/be1bdc0c666f15a00d6d8922a487123b44d2446f4df716508dd2629000a305ae/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4c616e736f7765622f4c6f73446f6d61696e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Lansoweb/LosDomain/?branch=master) [![SensioLabs Insight](https://camo.githubusercontent.com/9e32d421835050ce180b5f313a1633372dfa9a7e6ec3e065ca986fcd6ca1de1d/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f38316234613963302d616337662d343034372d396231322d6462653434336431333531372e7376673f7374796c653d666c6174)](https://insight.sensiolabs.com/projects/81b4a9c0-ac7f-4047-9b12-dbe443d13517) [![Dependency Status](https://camo.githubusercontent.com/aad794c632063f2c627219d86fa8ec5926f3f8c3b9926827bb6406a4c80ab242/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3534653834373063643165633537336339393030306330342f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/user/projects/54e8470cd1ec573c99000c04)

Introduction
------------

[](#introduction)

This module provides php configuration files based on the domain (or subdomain) being accessed.

For Zend Framework 2/3 [framework.zend.com](http://framework.zend.com/), please use version 1.0.

Todo
----

[](#todo)

### Todo

[](#todo-1)

- 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
-----------

[](#instalation)

```
composer require los/losdomain:^2.0
```

Usage
-----

[](#usage)

For example, in [Zend Expressive](http://zendframework.github.io/zend-expressive/), add the following code to your config/config.php:

```
foreach (\LosDomain\DomainService::configFiles('config/autoload/domains') as $file) {
    $config = ArrayUtils::merge($config, include $file);
}
```

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:

```
