PHPackages                             nielspeen/rqlite-laravel-driver - 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. nielspeen/rqlite-laravel-driver

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

nielspeen/rqlite-laravel-driver
===============================

RQLite driver for Laravel

1.0(2y ago)111MITPHP

Since Jun 10Pushed 1y agoCompare

[ Source](https://github.com/nielspeen/rqlite-laravel-driver)[ Packagist](https://packagist.org/packages/nielspeen/rqlite-laravel-driver)[ Docs](https://github.com/nielspeen/rqlite-laravel-driver)[ RSS](/packages/nielspeen-rqlite-laravel-driver/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (2)Dependencies (11)Versions (3)Used By (0)

RQLite Driver for Laravel
=========================

[](#rqlite-driver-for-laravel)

Supported
---------

[](#supported)

- Eloquent Queries
- Read Consistency: Strong, Weak or None
- Read Freshness &amp; Strict Freshness
- Queued Writes
- Optional direct reading of SQLite database

Not (yet) Supported
-------------------

[](#not-yet-supported)

- Bulk Writes
- Bulk Selects
- Transactions

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

[](#installation)

Install using composer:

```
composer require nielspeen/rqlite-laravel-driver
```

Setup
-----

[](#setup)

Sample `config/database.php` configuration:

```
'connections' => [

        'rqlite' => [
            'url' => env('DB_RQLITE_URL', 'rqlite://127.0.0.1:4001/db'),
        ],

        'rqlite2' => [
            'driver' => env('DB_RQLITE_CONNECTION', 'rqlite'),
            'database' => env('DB_RQLITE_DATABASE', 'db'),
            'host' => env('DB_RQLITE_HOST', '127.0.0.1'),
            'port' => env('DB_RQLITE_PORT', '4001'),
            'username' => env('DB_RQLITE_USERNAME', null),
            'password' => env('DB_RQLITE_PASSWORD', null),
        ],

        // ...
   ]
```

Note that the database **db** name is ignored as RQLite currently supports only a single database. I recommend you specify a database name anyway, for maximum compatibility with Laravel.

Usage
-----

[](#usage)

By default, all queries are executed with **strong** consistency. You can specify the consistency level by using the methods show below.

### Using a Model Trait

[](#using-a-model-trait)

```
use Wanwire\RQLite\PDO\PDO;
use Wanwire\RQLite\WithRQLiteBuilder;

class MyModel extends Model

{
    use WithRQLiteBuilder;
    protected string $consistency = PDO::RQLITE_CONSISTENCY_STRONG; // or '_WEAK' or '_NONE'
```

### Extended RQLite Models

[](#extended-rqlite-models)

```
use \Wanwire\RQLite\Models\WeakConsistencyModel;

class MyModel extends WeakConsistencyModel
```

### Using the query builder:

[](#using-the-query-builder)

```
User::noConsistency()->where('admin', 1)->find(1);
User::weakConsistency()->find(323);
User::strongConsistency()->find(747);
```

### PDO

[](#pdo)

Sometimes you want to access the PDO object directly. For example:

```
$pdo = DB::getPdo();

// Set custom PDO attribute
$pdo->setAttribute(Wanwire\RQLite\Pdo\PDO::RQLITE_ATTR_QUEUED_WRITES, true);

// Perform a single query to update both columns
DB::table('users')
    ->where('user_id', 999)
    ->update([
        'bytes_downloaded' => DB::raw("bytes_downloaded + $bytesDownloaded"),
        'bytes_uploaded' => DB::raw("bytes_uploaded + $bytesUploaded"),
    ]);
```

### Warning

[](#warning)

The consistency level is not reset after a query is executed. Consecutive queries will use the same consistency level unless a new consistency level is set using the Trait, the Models, or the query builder.

This approach ensures that eager loading uses the same consistency level as the primary model being queried.

Directly reading from SQLite
----------------------------

[](#directly-reading-from-sqlite)

If you have a high traffic website, the overhead of going through RQLite can be significant. With some precautions, you can boost performance by reading directly from SQLite. This is applied to queries with **None** consistency only.

In your database.php add a sqlite parameter pointing directly and the dabase:

```
'connections' => [
        'rqlite' => [
            'driver' => env('DB_RQLITE_CONNECTION', 'rqlite'),
            'database' => env('DB_RQLITE_DATABASE', 'db'),
            'host' => env('DB_RQLITE_HOST', '127.0.0.1'),
            'port' => env('DB_RQLITE_PORT', '4001'),
            'username' => env('DB_RQLITE_USERNAME', null),
            'password' => env('DB_RQLITE_PASSWORD', null),
            'sqlite' => 'sqlite:/var/lib/rqlite/db.sqlite',

        ],
   ]
```

Secondly, you need to ensure your Laravel application has read-only access to the SQLite database.

Do NOT give your Laravel application write access to the SQLite database. This will corrupt the database! Even in read-only mode, SQLite will occasionally make modifications to the database incompatible with RQLite.

Credits
-------

[](#credits)

- \[nielspeen\]\[)
- [hushulin](https://github.com/hushulin)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50.9% 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 ~21 days

Total

2

Last Release

733d ago

Major Versions

0.1 → 1.02024-07-01

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5564176?v=4)[Niels Peen](/maintainers/nielspeen)[@nielspeen](https://github.com/nielspeen)

---

Top Contributors

[![nielspeen](https://avatars.githubusercontent.com/u/5564176?v=4)](https://github.com/nielspeen "nielspeen (56 commits)")[![hushulin](https://avatars.githubusercontent.com/u/4876973?v=4)](https://github.com/hushulin "hushulin (36 commits)")[![729380388](https://avatars.githubusercontent.com/u/70426209?v=4)](https://github.com/729380388 "729380388 (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (6 commits)")

---

Tags

laraveleloquenthushulinnielspeenrqliterqlite-laravel-driver

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/nielspeen-rqlite-laravel-driver/health.svg)

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

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k54.9M11.6k](/packages/illuminate-database)[watson/validating

Eloquent model validating trait.

9803.5M54](/packages/watson-validating)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.3M18](/packages/reedware-laravel-relation-joins)[wnx/laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.

213421.0k2](/packages/wnx-laravel-backup-restore)[lacodix/laravel-model-filter

A Laravel package to filter, search and sort models with ease while fetching from database.

17558.6k](/packages/lacodix-laravel-model-filter)[kolossal-io/laravel-multiplex

A Laravel package to attach versioned meta data to Eloquent models.

292110.7k1](/packages/kolossal-io-laravel-multiplex)

PHPackages © 2026

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