PHPackages                             waldemarnt/cake-multi-tenant - 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. waldemarnt/cake-multi-tenant

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

waldemarnt/cake-multi-tenant
============================

v0.0.7(10y ago)3751[1 issues](https://github.com/waldemarnt/cake-multi-tenant/issues)PHP

Since Dec 6Pushed 10y agoCompare

[ Source](https://github.com/waldemarnt/cake-multi-tenant)[ Packagist](https://packagist.org/packages/waldemarnt/cake-multi-tenant)[ RSS](/packages/waldemarnt-cake-multi-tenant/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (8)Used By (0)

Multi tenant CakePHP (2.x) Plugin
=================================

[](#multi-tenant-cakephp-2x-plugin)

The *Multi Tenant* plugin allows an application to be separated in several applications having own routes, sharing the same code and different databases (or the same).

\##Installing Via composer:

```
    composer require waldemarnt/cake-multi-tenant
```

Or just download the repository here

\##Configuration

\###bootstrap.php configuration

Just call the plugin **below the Dispatch** configuration in your boostrap, enable routes and boostrap.

```
    CakePlugin::load('CakeMultiTenant', array('routes' => true, 'bootstrap' => true));
```

\###core.php configuration In the core file you will need add the several properties. Current tenant (or default).

```
    Configure::write('Config.current_tenant', 'example');
```

Note: current tenant will be the active tenant, you can use this information to know which tenant is active.

Tenant configuration will be an array using the tenant name as a index and **connection\_name** will be the name of database connection that the tenant will use.

```
    Configure::write('Config.multi_tenant_config', [
            'example' => [
                'name' => 'Example Tenant',
                'connection_name' => 'my_custom_db_connection'
            ],
            'waldemar' => [
                'name' => 'Waldemar',
                'connection_name' => 'my_other_db_connection'
            ]
        ]
    );
```

\###database.php configuration In the database file you just need add the configuration for each tenant like this:

```
	public $my_custom_db_connection = array(
		'datasource' => 'Database/Mysql',
		'persistent' => false,
		'host' => '172.17.0.3',
		'login' => 'root',
		'password' => 'root',
		'database' => 'db_one',
		'prefix' => '',
		//'encoding' => 'utf8',
	);

	public $my_other_db_connection = array(
		'datasource' => 'Database/Mysql',
		'persistent' => false,
		'host' => '172.17.0.3',
		'login' => 'root',
		'password' => 'root',
		'database' => 'db_two',
		'prefix' => '',
		//'encoding' => 'utf8',
	);
```

### AppModel.php configuration

[](#appmodelphp-configuration)

Just extend your AppModel from MultiTenantAppModel, the MultiTenantAppModel that handles the database switch when the model will be created.

```
    App::uses('MultiTenantAppModel', 'CakeMultiTenant.Model');

    class AppModel extends MultiTenantAppModel {

    }
```

\###AppController.php In the AppController you will need configure two stuffs, **Html Helper** and **AuthComponent** (if you need auth :D). Html helper configuration:

```

    public $helpers = array(
        'Html' => array('className' => 'CakeMultiTenant.MultiTenantHtml'),
    );
```

AuthComponent configuration:

```
    public $components = array(
        'Auth' => [
			'className' => 'CakeMultiTenant.MultiTenantAuth'
    );
```

Note: you can add loginAction and LoginRedirect configurations in the Auth component there's no change in the original behavior of the component.

### Version

[](#version)

0.\*

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

7

Last Release

3847d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4347b3e468f0bf579a7e4684e5c877c0151ac32fc0b93a6c111f84fd59219eaa?d=identicon)[waldemarnt](/maintainers/waldemarnt)

---

Top Contributors

[![waldemarnt](https://avatars.githubusercontent.com/u/5835706?v=4)](https://github.com/waldemarnt "waldemarnt (8 commits)")

### Embed Badge

![Health badge](/badges/waldemarnt-cake-multi-tenant/health.svg)

```
[![Health](https://phpackages.com/badges/waldemarnt-cake-multi-tenant/health.svg)](https://phpackages.com/packages/waldemarnt-cake-multi-tenant)
```

###  Alternatives

[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.3k10](/packages/helsingborg-stad-municipio)[mautic/core

Mautic Open Source Distribution

9.8k2.6k9](/packages/mautic-core)[mediawiki/maps

Adds various mapping features to MediaWiki

78149.7k3](/packages/mediawiki-maps)[rainlab/blog-plugin

Blog plugin for October CMS

17158.6k](/packages/rainlab-blog-plugin)[civicrm/civicrm-drupal-8

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

19246.3k2](/packages/civicrm-civicrm-drupal-8)[starcitizentools/citizen-skin

A beautiful, usable, responsive MediaWiki skin with in-depth extension support. Originally developed for the Star Citizen Wiki.

3355.8k](/packages/starcitizentools-citizen-skin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
