PHPackages                             nexus-scholar/laravel-tenant-sqlite - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. nexus-scholar/laravel-tenant-sqlite

ActiveLibrary[Database &amp; ORM](/categories/database)

nexus-scholar/laravel-tenant-sqlite
===================================

Laravel package for isolated per-tenant SQLite databases

v1.0.0(1mo ago)00MITPHPPHP ^8.3CI passing

Since Apr 24Pushed 1mo agoCompare

[ Source](https://github.com/nexus-scholar/laravel-tenant-sqlite)[ Packagist](https://packagist.org/packages/nexus-scholar/laravel-tenant-sqlite)[ RSS](/packages/nexus-scholar-laravel-tenant-sqlite/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Laravel Tenant SQLite
=====================

[](#laravel-tenant-sqlite)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6e1dcd1f227dae2846daac60775565c5a0e64b6b4bccdb599084ee21e82f2054/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e657875732d7363686f6c61722f6c61726176656c2d74656e616e742d73716c6974652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nexus-scholar/laravel-tenant-sqlite)[![Total Downloads](https://camo.githubusercontent.com/da8595194a3afafedc76d72ffb9e73692f58d5f58a9fadade3d9f8ecb79113e4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e657875732d7363686f6c61722f6c61726176656c2d74656e616e742d73716c6974652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nexus-scholar/laravel-tenant-sqlite)[![Tests](https://github.com/nexus-scholar/laravel-tenant-sqlite/actions/workflows/tests.yml/badge.svg)](https://github.com/nexus-scholar/laravel-tenant-sqlite/actions/workflows/tests.yml)[![PHP Version Require](https://camo.githubusercontent.com/fd38faecc9c0b65eb3c11360789046f1eafc637d209418a695947d70439a3cc4/687474703a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e332b2d626c75652e737667)](https://php.net)

A robust and secure Laravel package for implementing multi-tenancy using an **isolated SQLite database file for each tenant**.

Instead of adding a `tenant_id` column to every table, this package gives each user (or organization) their own dedicated SQLite file. This approach guarantees complete data isolation, trivializes single-tenant backups, and simplifies data portability.

---

Features
--------

[](#features)

- 🔒 **Absolute Isolation:** Tenants physically cannot query each other's data.
- 📦 **Simple Backups:** Back up a tenant's entire dataset by copying a single `.sqlite` file.
- 🚀 **Dynamic Connections:** Seamlessly connects Eloquent models to the correct file at runtime.
- 🛠️ **Full Lifecycle Management:** Commands to create, migrate, inspect, backup, archive, and purge tenant databases.
- 🌐 **HTTP &amp; Queue Support:** Includes middleware to automatically resolve tenants for web requests and background jobs.
- ⚡ **Pest Tested:** Thoroughly tested for complete reliability and data isolation.

Documentation
-------------

[](#documentation)

For a comprehensive guide on getting started, setting up models, and writing migrations, please read our beginner's guide:

📖 **[Read the Beginner's Guide](docs/07-beginners-guide.md)**

For architectural details, consult the [docs directory](docs/README.md).

Quick Start
-----------

[](#quick-start)

### Installation

[](#installation)

```
composer require nexus-scholar/laravel-tenant-sqlite
php artisan tenant-database:install
php artisan migrate
```

### Basic Usage

[](#basic-usage)

1. Create a tenant migration in `database/migrations/tenant/0001_create_projects_table.php`.
2. Use the `UsesTenantConnection` trait on your models:

```
use Illuminate\Database\Eloquent\Model;
use NexusScholar\LaravelTenantSqlite\Concerns\UsesTenantConnection;

class Project extends Model
{
    use UsesTenantConnection;
}
```

3. Provision a tenant and run their migrations:

```
use NexusScholar\LaravelTenantSqlite\Facades\TenantDatabase;

$user = User::find(1);
TenantDatabase::provision($user);
TenantDatabase::migrate($user);
```

4. Use the middleware to automatically route requests to the correct database:

```
// routes/web.php
Route::middleware(['auth', 'tenant'])->group(function () {
    Route::get('/projects', function () {
        // This automatically queries the authenticated user's SQLite file!
        return App\Models\Project::all();
    });
});
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

47d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2d86d4859cd0f7e935dc056ca1155f5842ac8c590ebe8481d3051feb339885d7?d=identicon)[nexus-scholar](/maintainers/nexus-scholar)

---

Top Contributors

[![nexus-scholar](https://avatars.githubusercontent.com/u/233639653?v=4)](https://github.com/nexus-scholar "nexus-scholar (7 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/nexus-scholar-laravel-tenant-sqlite/health.svg)

```
[![Health](https://phpackages.com/badges/nexus-scholar-laravel-tenant-sqlite/health.svg)](https://phpackages.com/packages/nexus-scholar-laravel-tenant-sqlite)
```

###  Alternatives

[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k29.9M42](/packages/kirschbaum-development-eloquent-power-joins)[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8733.1M23](/packages/yajra-laravel-oci8)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.4M2](/packages/glushkovds-phpclickhouse-laravel)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

436834.4k1](/packages/clickbar-laravel-magellan)[laravel-liberu/laravel-gedcom

A package that converts gedcom files to Eloquent models

782.5k1](/packages/laravel-liberu-laravel-gedcom)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
