PHPackages                             crhg/laravel-sqlite-named-memory-connection - 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. crhg/laravel-sqlite-named-memory-connection

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

crhg/laravel-sqlite-named-memory-connection
===========================================

SQLite connector which supports named in-memory database connection

v1.1.3(6y ago)29.4k1[1 issues](https://github.com/crhg/laravel-sqlite-named-memory-connection/issues)[1 PRs](https://github.com/crhg/laravel-sqlite-named-memory-connection/pulls)MITPHPPHP &gt;=7.0.0CI failing

Since Aug 10Pushed 6y ago1 watchersCompare

[ Source](https://github.com/crhg/laravel-sqlite-named-memory-connection)[ Packagist](https://packagist.org/packages/crhg/laravel-sqlite-named-memory-connection)[ RSS](/packages/crhg-laravel-sqlite-named-memory-connection/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (9)Used By (0)

DESCRIPTION
===========

[](#description)

This package provides `sqlite-named` driver that extends Laravel's `sqlite` driver.

Using this driver allows you to specify a database in the form `named-memory:`. (`` is an arbitrary string (including empty string))

It connects to SQLite's in-memory database as well as `:memory:`. `:memory:` creates a new database for each connection, whereas `:named-memory:` returns the same connection if `` is same.

INSTALL
=======

[](#install)

```
composer require crhg/laravel-sqlite-named-memory-connection
```

CONFIGURATION
=============

[](#configuration)

Specify `sqlite-named` for` driver` in `config/database.php`.

`config/database.php`:

```
    'connections' => [
        //...
        'sqlite-named' => [
            'driver' => 'sqlite-named',
            'url' => env('DATABASE_URL'),
            'database' => env('DB_DATABASE', database_path('database.sqlite')),
            'prefix' => '',
            'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
        ],
        //...
    ],
```

`.env`:

```
DB_CONNECTION=sqlite-named
DB_DATABASE=:named-memory:foo
```

BACKGROUND
==========

[](#background)

SQLite's in-memory database is effective to speed up tests using the database. However, using `refreshApplication()` caused the problem of emptying the database.

This is due to the following reasons.

- Since the IoC container is regenerated, `\Illuminate\Database\DatabaseManager` that was registered as singleton is discarded and replaced with a new one.
- Information on the connected database managed by `DatabaseManager` is not passed to the newly generated` DatabaseManager`.
- When a connection to the DB is requested for the first time after `refreshApplication()`, the DatabaseManager has no connection, so a new connection to `:memory:` is generated
- The connection to `:memory:` is a connection to a newly created empty in-memory database.

If you use `:named-memory:` instead of `:memory:`, this problem can be avoided by returning the connection identified by ``which was used before `refreshApplication ()`.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

Every ~81 days

Recently: every ~14 days

Total

8

Last Release

2309d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bd1a173eef0d98c0451f8e692aeb623360da4c533d1d15e9d0f6edf5aa4fe12a?d=identicon)[crhg](/maintainers/crhg)

---

Top Contributors

[![crhg](https://avatars.githubusercontent.com/u/8174597?v=4)](https://github.com/crhg "crhg (10 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/crhg-laravel-sqlite-named-memory-connection/health.svg)

```
[![Health](https://phpackages.com/badges/crhg-laravel-sqlite-named-memory-connection/health.svg)](https://phpackages.com/packages/crhg-laravel-sqlite-named-memory-connection)
```

###  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

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

Oracle DB driver for Laravel via OCI8

8723.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.

438834.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)
