Download the PHP package kz370/krayin-multi-tenancy without Composer

On this page you can find all versions of the php package kz370/krayin-multi-tenancy. 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 krayin-multi-tenancy

Krayin CRM Multi-Tenancy

A multi-tenancy extension for Krayin CRM. This package enables Database-per-Tenant architecture, allowing you to host multiple isolated organizations on a single Krayin installation.

Tenants Overview

Installation

  1. Install via Composer:

  2. Publish Config & Migrations:

  3. Environment Setup: The package automatically uses your primary database connection (DB_DATABASE) as the "Landlord" (Central) database.

    Ensure your database user (in .env) has CREATE DATABASE permissions, as the package automatically creates new databases for each tenant.

    Variable Default Description
    DB_CONNECTION mysql The default connection.
    DB_LANDLORD_DATABASE NULL Optional. Defaults to your main DB_DATABASE.
  4. Setup Landlord Database: Run the migrations and the Krayin installer to set up the main system tables (including the tenants table).

🔐 Database User Permissions (Required)

This package automatically creates a new database for each tenant. Before using it, ensure that the database user configured in your .env file has permission to create databases.

Minimum Requirement

Your database user must have the CREATE DATABASE privilege.

If this permission is missing, tenant creation will fail.


Recommended (Safer) Permission Setup

For better security, it is strongly recommended to use a dedicated database user that can only manage tenant databases matching a specific naming pattern.

For example, if your tenant databases use a prefix like:

You can grant permissions only for those databases:

This ensures:


Using a Dedicated Tenant Database User (Optional)

You may optionally configure a separate database user exclusively for tenant management:

This user should only have privileges for tenant databases (using the prefix rule above), while your main application database can remain protected.


Summary


Configuration

You can customize behavior in config/multi_tenancy.php.

Option Key Default Description
Menu Visibility show_menu true Show/Hide "Tenants" in the admin sidebar.
Database Prefix database_prefix 'krayin_' Prefix for generated tenant DBs (e.g., krayin_client1).
Landlord Connection landlord_connection_name 'landlord' Internal connection name for the central DB.

Usage

1. Create a Tenant

  1. Log in to the Landlord Admin Panel (your main domain, e.g., app.com).
  2. Navigate to Tenants in the sidebar.
  3. Click Add Tenant and enter:
    • Name: The internal name for the tenant (e.g., "Acme Corp").
    • Subdomain: The prefix for their URL (e.g., acme -> acme.app.com).
    • Admin Details: The initial login credentials for the tenant's administrator.
  4. Hit Save.
    • System Action: The package creates a new database krayin_acme, runs all migrations, and seeds the admin user.

2. Access a Tenant

  1. Navigate to the tenant's subdomain (e.g., http://acme.localhost or http://acme.app.com).
  2. Log in with the Admin Email and Password defined during creation.
  3. All data created here (Leads, Persons, Settings) is essentially invisible to other tenants.

Important Notes

Artisan Commands

Use these commands to keep tenant databases up to date with your code.

Command Description
php artisan tenants:migrate Run migrate on all active tenant databases.
php artisan tenants:migrate 5 Run migrate on a specific tenant (ID: 5).
php artisan tenants:migrate --fresh --seed Destructive: Wipe and re-seed all tenant databases.

Troubleshooting

1. 404 Not Found on Tenant Subdomain

2. "Access Denied" during Tenant Creation

3. Migrations applied to Landlord but not Tenant

4. Admin Login Failed on Tenant


All versions of krayin-multi-tenancy with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0
illuminate/database Version ^10.0|^11.0
illuminate/routing Version ^10.0|^11.0
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 kz370/krayin-multi-tenancy contains the following files

Loading the files please wait ...