xyorqin / tenant-terminal
Interactive terminal for running Laravel commands within tenant context
Requires
- php: ^8.1
- illuminate/console: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2026-04-21 09:13:04 UTC
README
Interactive terminal for running Laravel commands within tenant context. Instead of typing php artisan tenants:run command --tenant=id, simply run php artisan tenant, select a tenant, and all subsequent commands will run in that tenant's context.
Installation
Via Composer (Packagist)
Eng oson usul - Packagist orqali:
composer require xyorqin/tenant-terminal
Git Repository orqali
Agar paket hali Packagist da bo'lmasa:
-
Git repository URL ni oling (GitHub, GitLab, Bitbucket, va h.k.)
-
Loyihangizning
composer.jsonfayliga qo'shing:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/your-username/tenant-terminal.git"
}
],
"require": {
"xyorqin/tenant-terminal": "dev-main"
}
}
- Composer orqali o'rnating:
composer require xyorqin/tenant-terminal:dev-main
Local Path orqali (Development)
- Paket local papkada bo'lsa:
{
"repositories": [
{
"type": "path",
"url": "./path/to/tenant-terminal"
}
],
"require": {
"xyorqin/tenant-terminal": "*"
}
}
- Run
composer update
Configuration
Publish the configuration file:
php artisan vendor:publish --tag=tenant-terminal-config
This will create a config/tenant-terminal.php file where you can customize the package settings.
Supported Tenant Packages
The package automatically detects and works with:
- stancl/tenancy - Most popular Laravel tenancy package
- spatie/laravel-multitenancy - Spatie's multitenancy package
- Custom tenant models - Configure via
tenant_modelin config
Usage
Basic Usage
-
Run the tenant command:
php artisan tenant
-
You'll see a list of available tenants:
Available Tenants: [1] Tenant Name (ID: 1) [2] Another Tenant (ID: 2) [3] Third Tenant (ID: 3) Select tenant number (or press Ctrl+X to exit): -
Enter the tenant number to select it
-
You're now in tenant context! Any command you run will execute within that tenant:
tenant:Tenant Name> migrate tenant:Tenant Name> db:seed tenant:Tenant Name> tinker -
To exit, type
exitor pressCtrl+X(orCmd+Xon Mac)
Example Session
$ php artisan tenant Available Tenants: [1] Acme Corp (ID: 1) [2] Example Inc (ID: 2) Select tenant number: 1 Entered tenant context: Acme Corp Type 'exit' or press Ctrl+X to leave tenant context tenant:Acme Corp> migrate Running migrations... tenant:Acme Corp> db:seed --class=UserSeeder Seeding database... tenant:Acme Corp> exit Exited tenant context.
Features
- ✅ Interactive tenant selection
- ✅ Automatic tenant context initialization
- ✅ All artisan commands work within tenant context
- ✅ No need to specify
--tenantflag for each command - ✅ Easy exit with
exitcommand orCtrl+X - ✅ Supports multiple tenant packages
- ✅ Command history support (if readline is available)
Requirements
- PHP >= 8.1
- Laravel >= 10.0
- A tenant package (stancl/tenancy, spatie/laravel-multitenancy, or custom)
License
MIT
Author
Xyorqin