PHPackages                             nomanurrahman/fresh-seed - 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. nomanurrahman/fresh-seed

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

nomanurrahman/fresh-seed
========================

seed and refresh every single table

v0.0.1(2mo ago)00MITPHPPHP ^8.0CI passing

Since May 21Pushed 2mo agoCompare

[ Source](https://github.com/nomanur/fresh-seed)[ Packagist](https://packagist.org/packages/nomanurrahman/fresh-seed)[ Docs](https://github.com/nomanurrahman/fresh-seed)[ RSS](/packages/nomanurrahman-fresh-seed/feed)WikiDiscussions main Synced 3w ago

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

Laravel Fresh Seed
==================

[](#laravel-fresh-seed)

[![Latest Version on Packagist](https://camo.githubusercontent.com/98737a59d3cc159ae064eafbe0c2ca8224ddd2dd81870eab5719549ea1e64ec3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f6d616e75727261686d616e2f66726573682d736565642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nomanurrahman/fresh-seed)[![Total Downloads](https://camo.githubusercontent.com/b9ce79634bd8e04f29f5d318d710b1f9a37cb4e1cf81ec1c3202e2076424a740/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6f6d616e75727261686d616e2f66726573682d736565642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nomanurrahman/fresh-seed)[![GitHub Actions](https://github.com/nomanurrahman/fresh-seed/actions/workflows/main.yml/badge.svg)](https://github.com/nomanurrahman/fresh-seed/actions/workflows/main.yml/badge.svg)

A lightweight Laravel package that allows you to truncate and re-seed database tables surgically. This is perfect for development when you need to refresh specific data without running a full `migrate:fresh --seed` which wipes your entire database.

---

Features
--------

[](#features)

- 🎯 **Surgical Refresh**: Truncate/delete only the tables you specify.
- 🔀 **Multi-Table Support**: Refresh multiple tables at once (e.g., `users,posts`).
- 📂 **Table Presets/Groups**: Define curated groups of tables in the config to refresh together.
- 🗺️ **Interactive Selection**: Run the command without arguments to select tables from an interactive console prompt.
- 🔍 **Dry-Run Preview**: Preview what actions would be performed without actually modifying database records.
- 🔌 **Custom Database Connections**: Execute the operations against a non-default connection.
- 🛡️ **Constraint Safety &amp; Safe Deletion**: Disables foreign key constraints during the process, with an optional `--safe` mode utilizing `DELETE` instead of `TRUNCATE` to support transactions and avoid implicit database commits.
- ⚙️ **Auto-Seeder Detection**: Automatically locates appropriate seeders using standard Laravel conventions.

---

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

[](#installation)

Install the package via composer as a development dependency:

```
composer require --dev nomanurrahman/fresh-seed
```

### Configuration (Optional)

[](#configuration-optional)

To configure presets/groups or default connections, publish the configuration file:

```
php artisan vendor:publish --provider="Nomanurrahman\FreshSeed\FreshSeedServiceProvider" --tag="config"
```

This will create a `config/fresh-seed.php` file:

```
return [
    /*
     * Define presets or groups of tables that can be refreshed together.
     * Groups can be an array of table names (auto-guesses seeders) or key-value pairs of table => seeder.
     */
    'groups' => [
        'auth' => [
            'users' => 'Database\\Seeders\\UserSeeder',
            'roles' => 'Database\\Seeders\\RoleSeeder',
            'permissions' => 'Database\\Seeders\\PermissionSeeder',
        ],
        'shop' => ['products', 'categories', 'orders'],
    ],

    /*
     * Default connection to use if not specified in command.
     */
    'connection' => null,
];
```

---

Usage
-----

[](#usage)

### 1. Interactive Selection

[](#1-interactive-selection)

Run the command without options to select which table(s) to refresh interactively:

```
php artisan fresh:seed
```

### 2. Basic Single-Table Refresh

[](#2-basic-single-table-refresh)

Refresh a single table and let the package locate the matching seeder automatically:

```
php artisan fresh:seed --table=users
```

> **Note:** For safety, the command asks for confirmation if run in a production environment. You can bypass this with the `--force` flag.

### 3. Multi-Table Refresh

[](#3-multi-table-refresh)

Refresh multiple tables sequentially using a comma-separated list:

```
php artisan fresh:seed --table=users,posts,comments
```

### 4. Running Table Groups

[](#4-running-table-groups)

Refresh pre-configured groups defined in `config/fresh-seed.php`:

```
php artisan fresh:seed --group=auth
```

### 5. Specifying a Custom Seeder

[](#5-specifying-a-custom-seeder)

Explicitly define a custom seeder class (only valid when refreshing a single table):

```
php artisan fresh:seed --table=users --seeder=CustomUserSeeder
```

### 6. Safe Deletions

[](#6-safe-deletions)

Use `DELETE` instead of `TRUNCATE` to avoid implicit database commits (useful for maintaining database transaction integrity):

```
php artisan fresh:seed --table=posts --safe
```

### 7. Dry-Run Mode

[](#7-dry-run-mode)

Preview the execution path without modifying database records:

```
php artisan fresh:seed --group=auth --dry-run
```

### 8. Targeting a Custom Connection

[](#8-targeting-a-custom-connection)

Run the refresh against a secondary or tenant database connection:

```
php artisan fresh:seed --table=users --database=tenant_1
```

---

How Seeder Detection Works
--------------------------

[](#how-seeder-detection-works)

If you don't provide a `--seeder` option or group mapping, the package looks for seeders in the following order:

1. `StudlyCaseTableNameTableSeeder` (e.g., `UsersTableSeeder`)
2. `StudlyCaseSingularTableNameSeeder` (e.g., `UserSeeder`)

Checks are conducted in both the root namespace and the standard `Database\Seeders\` namespace.

---

Testing
-------

[](#testing)

The package includes a comprehensive test suite. You can run the tests using:

```
composer test
```

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [nomanur rahman](https://github.com/nomanurrahman)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

31

—

LowBetter than 65% of packages

Maintenance87

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

65d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29956256?v=4)[Nomanur Rahman](/maintainers/nomanur)[@nomanur](https://github.com/nomanur)

---

Top Contributors

[![nomanur](https://avatars.githubusercontent.com/u/29956256?v=4)](https://github.com/nomanur "nomanur (3 commits)")

---

Tags

nomanurrahmanfresh-seed

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nomanurrahman-fresh-seed/health.svg)

```
[![Health](https://phpackages.com/badges/nomanurrahman-fresh-seed/health.svg)](https://phpackages.com/packages/nomanurrahman-fresh-seed)
```

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k54.9M12.2k](/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)

PHPackages © 2026

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