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

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

vi5tar/laravel-persistingdatabase
=================================

Setup data to persist throughout a test case.

v1.1.0-beta(3y ago)0559MITPHP

Since Sep 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Vi5tar/laravel-persistingdatabase)[ Packagist](https://packagist.org/packages/vi5tar/laravel-persistingdatabase)[ Docs](https://github.com/Vi5tar/laravel-persistingdatabase)[ RSS](/packages/vi5tar-laravel-persistingdatabase/feed)WikiDiscussions master Synced today

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

Persist data throughout a test case.
====================================

[](#persist-data-throughout-a-test-case)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e6582f4be5a96aed1d89dd32e3ce8a8060278979405f7277beb2c72c946ef9ec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7669357461722f6c61726176656c2d70657273697374696e6764617461626173652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vi5tar/laravel-persistingdatabase)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![GitHub Workflow Status](https://camo.githubusercontent.com/54ad8ea957b3b9cd6c52a49f37836b5a80119c36ef134abd833cc08a1a5f539e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7669357461722f6c61726176656c2d70657273697374696e6764617461626173652f504850253230436f6d706f7365723f6c6162656c3d6275696c642f7465737473)](https://github.com/vi5tar/laravel-persistingdatabase/actions)[![Total Downloads](https://camo.githubusercontent.com/0e198b332e7125960ecfb64045511d5fdd9788b944818291bc2e089e71892b49/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7669357461722f6c61726176656c2d70657273697374696e6764617461626173652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vi5tar/laravel-persistingdatabase)

This package provides a trait that can be used on a `Illuminate\Foundation\Testing\TestCase` to setup data once for the tests in that `TestCase`.

Notice:
-------

[](#notice)

This is an alternative to `Illuminate\Foundation\Testing\RefreshDatabase`. Use one or the other depending on the needs of the tests.

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

[](#installation)

Install via composer:

```
composer require vi5tar/laravel-persistingdatabase
```

Usage
-----

[](#usage)

```
use ArticleSeeder;
use PostSeeder;
use Tests\TestCase;
use Vi5tar\PersistingDatabase;

class ExampleTest extends TestCase
{
    use PersistingDatabase;

    public function setupDb(): void
    {
        $this->seed([
            ArticleSeeder::class,
            PostSeeder::class
        ]);
    }

    /**
     * A basic feature test example.
     *
     * @return void
     */
    public function articleIndexTest()
    {
        $response = $this->get('/articles');

        $response->assertStatus(200);
    }

    /**
     * A basic feature test example.
     *
     * @return void
     */
    public function postIndexTest()
    {
        $response = $this->get('/posts');

        $response->assertStatus(200);
    }
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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 ~766 days

Total

2

Last Release

1289d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/26010111?v=4)[Travis Swiers](/maintainers/Vi5tar)[@Vi5tar](https://github.com/Vi5tar)

---

Top Contributors

[![thechrise](https://avatars.githubusercontent.com/u/15894470?v=4)](https://github.com/thechrise "thechrise (1 commits)")[![Vi5tar](https://avatars.githubusercontent.com/u/26010111?v=4)](https://github.com/Vi5tar "Vi5tar (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[orchestra/testbench

Laravel Testing Helper for Packages Development

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

Testing helpers for your OpenAPI spec

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

Workbench Companion for Laravel Packages Development

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