Skip to content
Switch branches/tags
This branch is 7 commits ahead, 378 commits behind tenancy:5.x.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Packagist build status codecov Packagist Codacy Badge Join our Discord server Mentioned in Awesome Laravel

The unobtrusive Laravel package that makes your app multi tenant. Serving multiple websites, each with one or more hostnames from the same codebase. But with clear separation of assets, database and the ability to override logic per tenant.

Suitable for marketing companies that like to re-use functionality for different clients or start-ups building the next software as a service.


  • Integration with all Long Term Support versions of Laravel, which includes 5.5.
  • Event driven, extensible architecture.
  • Close integration into the webserver.
  • The ability to add tenant specific configs, code, routes etc.

Database separation methods:

  • One system database and separated tenant databases (default).
  • Table prefixed in the system database.
  • Or .. manually, the way you want, by listening to an event.

Complete documentation covers more than just the installation and configuration.

Requirements, recommended environment

  • Laravel 5.5.
  • Linux based OS preferred.
  • PHP 7.
  • Apache or Nginx.

Please read the full requirements in the documentation.


composer require hyn/multi-tenant

Automatic service registration

Using auto discovery, the tenancy package will be auto detected by Laravel automatically.

Manual service registration

In case you want to disable webserver integration or prefer manual integration, set the dont-discover in your application composer.json, like so:

    "extra": {
        "laravel": {
            "dont-discover": "hyn/multi-tenant"

If you disable auto discovery you are able to configure the providers by yourself.

Register the service provider in your config/app.php:

    'providers' => [
        // [..]
        // Hyn multi tenancy.
        // Hyn multi tenancy webserver integration.

Deploy configuration

First publish the configuration files so you can modify it to your needs:

php artisan vendor:publish --tag tenancy

Open the config/tenancy.php and config/webserver.php file and modify to your needs.

Make sure your system connection has been configured in database.php. In case you didn't override the system connection name the default connection is used.

Now run:

php artisan tenancy:install

This will run the required system database migrations.

Support development

Maintaining and extending this package is very time consuming. By becoming a patron at you act as an inspiration and it allows you to become more closely involved.

All of my patrons receive additional benefits!

License and contributing

This package is offered under the MIT license. In case you're interested at contributing, make sure to read the contributing guidelines.


Run tests using (not recommended when using MySQL database driver):


Please note this will create an enormous number of tenant databases. You can easily remove these by running the bash script to clean the local databases that follow the same naming convention as this package:

bash tests/scripts/

Please be warned this will reset your current application completely, dropping tenant and system databases and removing the tenancy.json file inside the Laravel directory.


All changes are covered in the changelog.


Get in touch personally using;

Keep informed about news of this package by signing up for the newsletter.


Run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups.




No packages published