PHPackages                             placetopay/cerberus - 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. placetopay/cerberus

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

placetopay/cerberus
===================

Allows multiple tenants on Laravel applications

4.0.1(12mo ago)08.5k↓43.8%6[1 issues](https://github.com/placetopay-org/cerberus/issues)MITPHPPHP ^8.2CI passing

Since Jul 6Pushed 11mo ago6 watchersCompare

[ Source](https://github.com/placetopay-org/cerberus)[ Packagist](https://packagist.org/packages/placetopay/cerberus)[ RSS](/packages/placetopay-cerberus/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (51)Used By (0)

Placetopay multitenancy package
===============================

[](#placetopay-multitenancy-package)

This package is based on the third version of package `spatie/laravel-multitenancy`.

Because it is a customization, it requires override steps mentioned below for proper installation.

[More information about the package](https://github.com/spatie/laravel-multitenancy/tree/v1).

This package aims to standardize the configuration of the `tenants` table of the landlord database, in addition to reducing the number of queries made to the same database by using cache.

Prerequsites
------------

[](#prerequsites)

- `php8.2+`
- `Laravel ^11.0|^12.0`

Installation
------------

[](#installation)

This package can be installed via composer:

```
composer require "placetopay/cerberus:^4.0"
```

### Publishing the config file

[](#publishing-the-config-file)

You must publish the config file:

```
php artisan vendor:publish --tag="multitenancy-config"
```

### Publishing the migrate file

[](#publishing-the-migrate-file)

```
php artisan vendor:publish --tag="multitenancy-migrations"
```

### Create storage folder by tenancy

[](#create-storage-folder-by-tenancy)

This is allowed to run only if the application has the configuration variable **multitenancy.suffix\_storage\_path** set to true.

```
php artisan tenants:skeleton-storage --tenant=*
```

How to use
----------

[](#how-to-use)

After publish the config and migrations files, you need to create a new connection in `config/database.php`, This connection will allow the management of the landlord database, in which the tenants of the application will be stored.

```
'connections' => [
    ...
    'landlord' => [
        'driver' => env('DB_LANDLORD_DRIVER', 'mysql'),
        'url' => env('DB_LANDLORD_URL'),
        'host' => env('DB_LANDLORD_HOST', '127.0.0.1'),
        'port' => env('DB_LANDLORD_PORT', '3306'),
        'database' => env('DB_LANDLORD_DATABASE', 'forge'),
        'username' => env('DB_LANDLORD_USERNAME', 'forge'),
        'password' => env('DB_LANDLORD_PASSWORD', ''),
        'unix_socket' => env('DB_LANDLORD_SOCKET', ''),
        //...
    ],
  ...
]

```

The migration of the landlord table in relation to the spatie package was modified, adding a `config` field of json type, with which it's intended to centralize the configuration that is carried out in front of each tenant, in this field you can define the connection to the database using the following structure.

```
{
  "app": {
    "url": "...",
    "name": "..."
  },
  "database": {
    "connections": {
      "mysql": {
        "host": "...",
        "port": "...",
        "database": "...",
        "username": "..."
      }
    }
  }
}
```

You can add all configurations that you needed, this json will be convert in array dot structure and then will be set in the laravel config.

Additionally, the variable `APP_IDENTIFIER` is provided in the file `config/multitenancy.php` which will be the project identifier

### Execute migrations

[](#execute-migrations)

To execute the migrations of the landlord database, it's necessary to specify the connection and the path to the folder where the migrations are located:

```
php artisan migrate --database=landlord --path=database/migrations/laandlord/

```

### Jobs

[](#jobs)

You need to update the connection and tables for jobs and failed\_jobs, `config/queue.php`:

```
[
//...
'connections' => [
    'database' => [
        'connection' => env('DB_LANDLORD_CONNECTION'),
        'driver' => 'database',
        'table' => '{project_identifier}_jobs',
        'queue' => 'default',
        'retry_after' => 90,
        'after_commit' => false,
    ],
    //...
]
//...
]

//...
'failed' => [
    'driver' => env('QUEUE_FAILED_DRIVER', 'database'),
    'database' => env('DB_LANDLORD_CONNECTION', 'landlord'),
    'table' => '{project_identifier}_failed_jobs',
],

```

### Storage

[](#storage)

This package will overwrite the Storage Facade by default, setting a tenant's name as a prefix for folders that use with Storage Facade, if you need to suffix the `storage_path()` method too, you need to set to true the variable `suffix_storage_path` in `config/multitenant.php` file.

### How change the commands

[](#how-change-the-commands)

To execute any command for one tenant you need to execute the next command structure `php artisan tenants:artisan "command:execute" --tenant={tenant_domain} `

Addig the `--tenant={tenant_domain}` flag, will be executed the commando only for the specific tenant, without this it will execute by each tenant.

### translatable attributes

[](#translatable-attributes)

You can use the translate method in the tenant model to translate some keys from the config JSON. This method uses the app locale and fallback to search the correct values from the JSON, addionaly you should use a `config/tenant.php` file to set default values for translations in case if doesn't exist in the JSON data:

Json data from database

```
{
    "tenant": {
        "terms_and_privacy": {
            "es_CO": "Al continuar acepto la   política de protección de datos personales de Empresas del Grupo Evertec y sus filiales y subsidiarias"
        }
    }
}
```

Default values in `config/tenant.php`:

```
return [
'terms_and_privacy' => [
        'en' => sprintf('By continuing, you accept the  personal data protection policy  of Companies of the Evertec Group and its affiliates and subsidiaries', 'https://www.placetopay.com/web/politicas-de-privacidad'),
        'it' => sprintf('Continuando ad accettare la  politica di protezione dei dati personali  di Società del Gruppo Evertec e delle sue affiliate e sussidiarie', 'https://www.placetopay.com/web/politicas-de-privacidad'),
        'pt' => sprintf('Ao continuar, você aceita a  política de proteção de dados pessoais  da Empresas do Grupo Evertec e suas afiliadas e subsidiárias', 'https://www.placetopay.com/web/politicas-de-privacidad'),
    ],
]

```

Example of use:

```
app('currentTenant')->translate('terms_and_privacy')

```

### Clear cache remotely

[](#clear-cache-remotely)

Probably you need to clear the app cache when you update the tenant information, to do this Cerberus publish a new POST route `clean-cache` that you can call from another application.

this route use middleware to validate if the application can be connected, this is an example of how you need to make the request

```
$data = [
    'action' => 'cache:clear', //allowed action to perform
];

$signature = hash_hmac('sha256', json_encode($data), config('multitenancy.middleware_key'));

$url = 'https://tenant1.app.com/clean-cache';

Http::withHeaders(['Signature' => $signature])->post($url, $data);

```

You need to set this header in the request to clean the cache

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance50

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 82.8% 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 ~50 days

Recently: every ~103 days

Total

29

Last Release

364d ago

Major Versions

v1.8.6 → v2.0.02022-03-24

1.8.7 → 2.1.02023-04-13

v2.2.0 → 3.0.02023-07-28

3.0.5 → 4.0.02025-05-19

PHP version history (4 changes)v1.0PHP ^7.4

v1.6.0PHP ^7.4 | ^8.0

v2.0.0PHP ^8.0

4.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/188a6d118a8949533ff4154931c90b50f20e0fdebfb98831fd215a50430cfa67?d=identicon)[placetopay](/maintainers/placetopay)

---

Top Contributors

[![davidv99](https://avatars.githubusercontent.com/u/17091646?v=4)](https://github.com/davidv99 "davidv99 (96 commits)")[![eduarguz](https://avatars.githubusercontent.com/u/14934055?v=4)](https://github.com/eduarguz "eduarguz (6 commits)")[![avidal2433](https://avatars.githubusercontent.com/u/48190861?v=4)](https://github.com/avidal2433 "avidal2433 (4 commits)")[![andrextor](https://avatars.githubusercontent.com/u/26684203?v=4)](https://github.com/andrextor "andrextor (4 commits)")[![freddiegar](https://avatars.githubusercontent.com/u/8710491?v=4)](https://github.com/freddiegar "freddiegar (3 commits)")[![susanas7](https://avatars.githubusercontent.com/u/66875758?v=4)](https://github.com/susanas7 "susanas7 (2 commits)")[![hmgonzalez](https://avatars.githubusercontent.com/u/101215757?v=4)](https://github.com/hmgonzalez "hmgonzalez (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/placetopay-cerberus/health.svg)

```
[![Health](https://phpackages.com/badges/placetopay-cerberus/health.svg)](https://phpackages.com/packages/placetopay-cerberus)
```

###  Alternatives

[peppeocchi/php-cron-scheduler

PHP Cron Job Scheduler

8282.5M34](/packages/peppeocchi-php-cron-scheduler)[zackkitzmiller/tiny

A reversible base62 ID obfuscater.

401208.4k](/packages/zackkitzmiller-tiny)[klaussilveira/gitter

Gitter allows you to interact in an object oriented manner with Git repositories.

20032.4k5](/packages/klaussilveira-gitter)[lezhnev74/pasvl

Array Validator (regular expressions for nested array, sort of)

5253.7k3](/packages/lezhnev74-pasvl)

PHPackages © 2026

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