Download the PHP package orchestra/tenanti without Composer

On this page you can find all versions of the php package orchestra/tenanti. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package tenanti

Multi-tenant Database Schema Manager for Laravel

Tenanti allow you to manage multi-tenant data schema and migration manager for your Laravel application.

tests Latest Stable Version Total Downloads Latest Unstable Version License Coverage Status

Version Compatibility

Laravel Tenanti
5.5.x 3.5.x
5.6.x 3.6.x
5.7.x 3.7.x
5.8.x 3.8.x
6.x 4.x
7.x 5.x
8.x 6.x

Installation

To install through composer, run the following command from terminal:

Configuration

Next add the following service provider in config/app.php.

The command utility is enabled via Orchestra\Tenanti\CommandServiceProvider.

Aliases

To make development easier, you could add Orchestra\Support\Facades\Tenanti alias for easier reference:

Publish Configuration

To make it easier to configuration your tenant setup, publish the configuration:

Usage

Configuration Tenant Driver for Single Database

Open config/orchestra/tenanti.php and customize the drivers.

You can customize, or add new driver in the configuration. It is important to note that model configuration only work with Eloquent instance.

Setup migration autoload

For each driver, you should also consider adding the migration path into autoload (if it not already defined). To do this you can edit your composer.json.

composer.json

Setup Tenantor Model

Now that we have setup the configuration, let add an observer to our User class:

and your App\Observers\UserObserver class should consist of the following:

Console Support

Tenanti include additional command to help you run bulk migration when a new schema is created, the available command resemble the usage available from php artisan migrate namespace.

Command Description
php artisan tenanti:install {driver} Setup migration table on each entry for a given driver.
php artisan tenanti:make {driver} {name} Make a new Schema generator for a given driver.
php artisan tenanti:migrate {driver} Run migration on each entry for a given driver.
php artisan tenanti:rollback {driver} Rollback migration on each entry for a given driver.
php artisan tenanti:reset {driver} Reset migration on each entry for a given driver.
php artisan tenanti:refresh {driver} Refresh migration (reset and migrate) on each entry for a given driver.
php artisan tenanti:queue {driver} {action} Execute any of above action using separate queue to minimize impact on current process.
php artisan tenanti:tinker {driver} {id} Run tinker using a given driver and ID.

Multi Database Connection Setup

Instead of using Tenanti with a single database connection, you could also setup a database connection for each tenant.

Configuration Tenant Driver for Multiple Database

Open config/orchestra/tenanti.php and customize the drivers.

By introducing a migration config, you can now setup the migration table name to be tenant_migrations instead of user_{id}_migrations.

Database Connection Resolver

For tenanti to automatically resolve your multiple database connection, we need to setup the resolver. You can do this via:

Behind the scene, $config will contain the template database configuration fetch from "database.connections.tenants" (based on the first parameter tenants). We can dynamically modify the connection configuration and return the updated configuration for the tenant.

Setting Default Database Connection

Alternatively you can also use Tenanti to set the default database connection for your application:

Most of the time, this would be use in a Middleware Class when you resolve the tenant ID based on Illuminate\Http\Request object.


All versions of tenanti with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3 || ^8.0
illuminate/console Version ^8.40
illuminate/filesystem Version ^8.40
illuminate/support Version ^8.40
orchestra/model Version ^6.0
orchestra/support Version ^6.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package orchestra/tenanti contains the following files

Loading the files please wait ....