PHPackages                             ampeco/fast-sqlite-refresh-database - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. ampeco/fast-sqlite-refresh-database

ActiveModule[Testing &amp; Quality](/categories/testing)

ampeco/fast-sqlite-refresh-database
===================================

Alternative to migrations for each test

1.2.0(4mo ago)131.1k↓28.6%MITPHPPHP ^8.0

Since Feb 1Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/ampeco/fast-sqlite-refresh-database)[ Packagist](https://packagist.org/packages/ampeco/fast-sqlite-refresh-database)[ RSS](/packages/ampeco-fast-sqlite-refresh-database/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (10)Used By (0)

Alternative to the default laravel behaviour that will refresh the sqlite database for each test.

Also, an alternative to squashing migrations, since that still has to import the squashed migration on each test.

In this implementation no transactions are used when starting a test and the database is refreshed by deleting the sqlite file and recreating it from a clean template!

Instructions
============

[](#instructions)

1. Install the package

```
composer require --dev ampeco/fast-sqlite-refresh-database

```

2. Make sure you are not using in-memory database, but a sqlite file based one for your test setup
3. In your test instead of `use RefreshDatabase;` use `use FastSqliteRefreshDatabase;`
4. Run your tests

Performance
===========

[](#performance)

We tested it in an internal Feature testing suit with 86 tests. Using `LazyRefreshDatabase` we got:

```
ParaTest v6.9.1 upon PHPUnit 9.6.7 by Sebastian Bergmann and contributors.

................................................................. 65 / 86 ( 75%)
.....................                                             86 / 86 (100%)

Time: 01:09.101, Memory: 39.12 MB

```

Then we switched to `FastSqliteRefreshDatabase` and got:

```
ParaTest v6.9.1 upon PHPUnit 9.6.7 by Sebastian Bergmann and contributors.

................................................................. 65 / 86 ( 75%)
.....................                                             86 / 86 (100%)

Time: 00:06.894, Memory: 39.12 MB

```

Additional speed improvement
----------------------------

[](#additional-speed-improvement)

### Preheating the database

[](#preheating-the-database)

If you are running a lot of test in CI for example. You can call `php artisan fast-sqlite-refresh-database:preheat` before running your tests. This will create a clean sqlite database file that can be copied for each test. This will speed up your tests even more!

In order to tell your tests to use the preheated database, you can set the environment variable `FAST_SQLITE_REFRESH_DATABASE_PREHEATED` to `true` before running your tests.

```
FAST_SQLITE_REFRESH_DATABASE_PREHEATED=true php vendor/bin/paratest

```

Here is the same test with preheated database:

```
ParaTest v6.9.1 upon PHPUnit 9.6.7 by Sebastian Bergmann and contributors.

................................................................. 65 / 86 ( 75%)
.....................                                             86 / 86 (100%)

Time: 00:05.916, Memory: 39.12 MB

```

### Ramdisk

[](#ramdisk)

Running a large set of tests can create a lot of IO, for this reason you can use a ramdisk to store the sqlite database file.

On macOS you could use APFS or HFS+ ramdisk. From our tests HFS+ appears to be faster by 3-4%.

```
# APFS
diskutil apfs create $(hdiutil attach -nomount ram://1048576) ramdisk && touch /Volumes/ramdisk/.metadata_never_index &&  touch /Volumes/ramdisk/.fseventsd/no_log
#HFS+
diskutil erasevolume HFS+ ramdisk $(hdiutil attach -nomount ram://1048576) && touch /Volumes/ramdisk/.metadata_never_index &&  touch /Volumes/ramdisk/.fseventsd/no_log
```

To unmount the ramdisk:

```
diskutil eject /Volumes/ramdisk
```

On linux you can use `tmpfs`

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance76

Regular maintenance activity

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~88 days

Recently: every ~177 days

Total

9

Last Release

130d ago

PHP version history (2 changes)1.0.0PHP ^7.4|^8.0

1.0.1PHP ^8.0

### Community

Maintainers

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

---

Top Contributors

[![mspasov](https://avatars.githubusercontent.com/u/469995?v=4)](https://github.com/mspasov "mspasov (2 commits)")[![dmtar](https://avatars.githubusercontent.com/u/37380766?v=4)](https://github.com/dmtar "dmtar (1 commits)")

### Embed Badge

![Health badge](/badges/ampeco-fast-sqlite-refresh-database/health.svg)

```
[![Health](https://phpackages.com/badges/ampeco-fast-sqlite-refresh-database/health.svg)](https://phpackages.com/packages/ampeco-fast-sqlite-refresh-database)
```

###  Alternatives

[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[hotmeteor/spectator

Testing helpers for your OpenAPI spec

3021.4M1](/packages/hotmeteor-spectator)[orchestra/workbench

Workbench Companion for Laravel Packages Development

8217.0M43](/packages/orchestra-workbench)[botble/git-commit-checker

Check coding standard &amp; code syntax with Git pre-commit hook.

47186.4k1](/packages/botble-git-commit-checker)[guanguans/laravel-soar

SQL optimizer and rewriter for laravel. - laravel 的 SQL 优化器和重写器。

2227.8k](/packages/guanguans-laravel-soar)[spurwork/spectator

Testing helpers for your OpenAPI spec

3021.5k](/packages/spurwork-spectator)

PHPackages © 2026

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