Coder Social home page Coder Social logo

bmorelax / multi-tenant Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tenancy/multi-tenant

0.0 0.0 0.0 1.29 MB

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

Home Page: http://laravel-tenancy.com

License: MIT License

PHP 98.45% HTML 0.93% Shell 0.62%

multi-tenant's Introduction

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.


Offers:

  • Integration with the awesome Laravel framework.
  • Event driven, extensible architecture.
  • Close - optional - integration into the web server.
  • 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

  • Latest stable and LTS Laravel versions.
  • PHP 7+.
  • Apache or Nginx.
  • MySQL, MariaDB or PostgreSQL.

Please read the full requirements in the documentation.

Installation

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\Tenancy\Providers\TenancyProvider::class,
        // Hyn multi tenancy webserver integration.
        Hyn\Tenancy\Providers\WebserverProvider::class,
    ],

Deploy configuration

First publish the configuration and migration 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 migrate --database=system

This will run the required system database migrations.


Backers

Thank you to all our backers! ๐Ÿ™ [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

Contributors


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.

Testing

Run tests using:

vendor/bin/phpunit

If using MySQL, use:

LIMIT_UUID_LENGTH_32=1 vendor/bin/phpunit

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

Changes

All changes are covered in the changelog.

Contact

Get in touch personally using;

multi-tenant's People

Contributors

luceos avatar thijmen avatar bkintanar avatar fletch3555 avatar joshjacks avatar janiskelemen avatar tnovalis avatar nevertry avatar julianfox avatar yuters avatar mintunitish avatar sti3bas avatar ametad avatar ianlchapman avatar monkeywithacupcake avatar londoh avatar deltoss avatar piranhageorge avatar dayvisson avatar clarkwinkelmann avatar bogdankharchenko avatar balping avatar austinmaddox avatar asdullahsiddique avatar vortechron avatar aaronfahey avatar almas1992 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.