Download the PHP package takeshiyu/tenantify without Composer
On this page you can find all versions of the php package takeshiyu/tenantify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download takeshiyu/tenantify
More information about takeshiyu/tenantify
Files in takeshiyu/tenantify
Package tenantify
Short Description Tenantify is a Laravel package designed to make implementing a multi-tenancy architecture easy and efficient. With Tenantify, you can quickly set up your application to support multiple tenants using a single database, with each tenant being identified by a unique subdomain.
License MIT
Informations about the package tenantify
Tenantify
Tenantify is a Laravel package designed to make implementing a lightweight multi-tenancy architecture easy and efficient. With Tenantify, you can quickly set up your application to support multiple tenants using a single database, with each tenant being identified by a unique subdomain.
Features
- Automatic subdomain detection and tenant resolution
- Subdomain-based routing with Laravel route macro
- Tenant-aware query scopes
- Middleware for tenant context and data isolation
Installation
To install Tenantify, follow these simple steps:
-
Install the package via Composer:
- Publish the configuration file and model:
Configuration
After installing Tenantify, you can configure it according to your application's requirements. Open the config/tenantify.php
file and adjust the settings as needed:
Custom Model
By default, Tenantify uses App\Models\Tenant
( configured in config/tenantify.php
) as the tenant model, but you can adjust the default model according to your application's needs. Please make sure to use the TakeshiYu\Tenantify\Concerns\Tenantable
trait in your model.
Query Scopes
To scope your queries correctly, apply the TakeshiYu\Tenantify\Concerns\HasTenancy
trait on your models:
Usage
In routes/web.php
file, define your tenant-specific routes using the tenancy
macro:
or, assign TakeshiYu\Tenantify\Middleware\ResolveTenant
middleware to your routes or groups:
Current Tenant
There are several methods available to work with current tenant:
If no tenant is found, it will throw the TenancyNotInitializedException
.
Testing
You can run the package's tests:
License
Tenantify is open-sourced software licensed under the MIT license.