PHPackages                             litebase/litebase-laravel - 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. litebase/litebase-laravel

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

litebase/litebase-laravel
=========================

Litebase SDK for Laravel

v0.5.4(5mo ago)30MITPHPPHP ^8.4CI passing

Since Nov 26Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/litebase/litebase-laravel)[ Packagist](https://packagist.org/packages/litebase/litebase-laravel)[ Docs](https://litebase.com)[ GitHub Sponsors](https://github.com/litebase)[ RSS](/packages/litebase-litebase-laravel/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (8)Versions (6)Used By (0)

Litebase Laravel SDK (Alpha)
============================

[](#litebase-laravel-sdk-alpha)

[![tests](https://github.com/litebase/litebase-laravel/actions/workflows/tests.yml/badge.svg)](https://github.com/litebase/litebase-laravel/actions/workflows/tests.yml)[![GitHub License](https://camo.githubusercontent.com/35b2e911aec7f1897602ab20f7eddc1a357f0db1dac6bf898da2aa3fa7158746/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6c697465626173652f6c697465626173652d6c61726176656c)](https://github.com/litebase/litebase-laravel/blob/main/LICENSE.md)

A Laravel database driver for [Litebase](https://github.com/litebase/litebase), an open source distributed database built on SQLite, distributed file systems, and object storage.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require litebase/litebase-laravel
```

The service provider will be automatically registered.

Configuration
-------------

[](#configuration)

Add a Litebase connection to your `config/database.php`:

```
'connections' => [
    // ... other connections

    'litebase' => [
        'driver' => 'litebase',
        'database' => env('LITEBASE_DATABASE', 'your_database/main'),
        'host' => env('LITEBASE_HOST', 'localhost'),
        'port' => env('LITEBASE_PORT', '8888'),
        'access_key_id' => env('LITEBASE_ACCESS_KEY_ID'),
        'access_key_secret' => env('LITEBASE_ACCESS_KEY_SECRET'),
    ],
],
```

Add the corresponding environment variables to your `.env`:

```
LITEBASE_HOST=localhost
LITEBASE_PORT=8888
LITEBASE_ACCESS_KEY_ID=lbakid_**********
LITEBASE_ACCESS_KEY_SECRET=lbaks_**********
LITEBASE_DATABASE=your_database/main
```

Usage
-----

[](#usage)

Once configured, you can use Litebase like any other Laravel database connection:

### Query Builder

[](#query-builder)

```
use Illuminate\Support\Facades\DB;

// Select
$users = DB::connection('litebase')
    ->table('users')
    ->where('active', true)
    ->get();

// Insert
DB::connection('litebase')
    ->table('users')
    ->insert([
        'name' => 'John Doe',
        'email' => 'john@example.com',
    ]);

// Update
DB::connection('litebase')
    ->table('users')
    ->where('id', 1)
    ->update(['name' => 'Jane Doe']);

// Delete
DB::connection('litebase')
    ->table('users')
    ->where('id', 1)
    ->delete();
```

### Eloquent Models

[](#eloquent-models)

```
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    protected $connection = 'litebase';
    protected $table = 'users';
}

// Use the model
$user = User::create([
    'name' => 'John Doe',
    'email' => 'john@example.com',
]);

$users = User::where('active', true)->get();
```

### Migrations

[](#migrations)

Use Laravel's migration system as usual:

```
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    protected $connection = 'litebase';

    public function up()
    {
        Schema::connection('litebase')->create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('email')->unique();
            $table->boolean('active')->default(true);
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::connection('litebase')->dropIfExists('users');
    }
};
```

Run migrations:

```
php artisan migrate --database=litebase
```

### Schema Operations

[](#schema-operations)

```
use Illuminate\Support\Facades\Schema;

// Check if table exists
if (Schema::connection('litebase')->hasTable('users')) {
    // ...
}

// Get all tables
$tables = Schema::connection('litebase')->getTables();

// Get table columns
$columns = Schema::connection('litebase')->getColumns('users');
```

### Transactions

[](#transactions)

```
use Illuminate\Support\Facades\DB;

DB::connection('litebase')->transaction(function () {
    DB::connection('litebase')
        ->table('users')
        ->insert(['name' => 'John Doe', 'email' => 'john@example.com']);

    DB::connection('litebase')
        ->table('logs')
        ->insert(['action' => 'user_created']);
});
```

### Interactive Database Shell

[](#interactive-database-shell)

The package includes an interactive database shell command:

```
php artisan litebase:db [connection?]
```

This provides an interactive SQL prompt where you can execute queries directly against your Litebase database.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/litebase/litebase-laravel?tab=contributing-ov-file) for details.

### Testing

[](#testing)

Run unit tests:

```
composer test
```

Run integration tests (requires Docker):

```
composer test-integration
```

*Integration tests require a running Litebase Server. When running integration tests, a server will be automatically started using Docker.*

Run static analysis:

```
composer phpstan
```

Run code style checks:

```
composer pint
```

Code of Conduct
---------------

[](#code-of-conduct)

Please see [Code of Conduct](https://github.com/litebase/litebase-laravel?tab=coc-ov-file) for details.

Security
--------

[](#security)

All security related issues should be reported directly to .

License
-------

[](#license)

Litebase is [open-sourced](https://opensource.org/) software licensed under the [MIT License](LICENSE.md).

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance70

Regular maintenance activity

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.5% 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

Every ~12 days

Total

5

Last Release

172d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/94542076?v=4)[Litebase](/maintainers/litebase)[@litebase](https://github.com/litebase)

---

Top Contributors

[![tlaverdure](https://avatars.githubusercontent.com/u/1731025?v=4)](https://github.com/tlaverdure "tlaverdure (42 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

---

Tags

databaselaravellitebasephpsdksqlsqlite

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/litebase-litebase-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/litebase-litebase-laravel/health.svg)](https://phpackages.com/packages/litebase-litebase-laravel)
```

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k54.9M11.6k](/packages/illuminate-database)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[glushkovds/phpclickhouse-laravel

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

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)[lemaur/eloquent-publishing

218.1k1](/packages/lemaur-eloquent-publishing)[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)
