Download the PHP package revoltify/tenantify without Composer
On this page you can find all versions of the php package revoltify/tenantify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download revoltify/tenantify
More information about revoltify/tenantify
Files in revoltify/tenantify
Package tenantify
Short Description Single database multi-tenant solution for Laravel
License MIT
Informations about the package tenantify
Tenantify
A powerful and flexible single-database multi-tenant solution for Laravel 11, built with SOLID principles in mind.
Features
- Early Identification: Initialize tenants during application boot for maximum performance
- Flexible Resolution: Support for domain and subdomain-based tenant resolution
- Customizable Bootstrapping: Add your own tenant bootstrapping logic
- Tenant-Aware Systems:
- Queue system with automatic tenant context
- Cache system with tenant-specific prefixes
- Session management with tenant isolation
- Built-in Spatie Permissions Support: Automatic tenant-specific permission caching
- Automatic Tenant Scoping: Zero-effort tenant data isolation with the
BelongsToTenant
trait - High Performance: Optimized resolver with optional caching
- Developer Friendly: Clear API with helper functions
Requirements
- PHP 8.2 or higher
- Laravel 11.x
Installation
-
Install the package via Composer:
- Run the installation command:
This will publish the configuration file and migrations.
- Run the migrations:
Configuration
The package can be configured via the config/tenantify.php
file. Here are the key configuration options:
Early Initialization
true
: Initializes tenant during application boot (recommended for fully tenant-aware applications)false
: Manual initialization through middleware (recommended for partially tenant-aware applications)
Custom Models
Resolver Configuration
Basic Usage
Creating a Tenant
Manual Tenant Initialization
Accessing Current Tenant
Advanced Usage
Custom Bootstrapper
Create a custom bootstrapper by extending the AbstractBootstrapper
class:
Register your bootstrapper in the configuration:
Model Tenant Scoping
Add automatic tenant scoping to your models using the BelongsToTenant
trait:
This will automatically:
- Add tenant ID on model creation
- Scope all queries to the current tenant
- Establish the tenant relationship
Usage example:
Tenant-Aware Jobs
Make your job tenant-aware by implementing the TenantAware
interface:
Contributing
Please see CONTRIBUTING.md for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Revoltify
- All Contributors
License
The MIT License (MIT). Please see License File for more information.