PHPackages                             ramadan/custom-fresh - 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. ramadan/custom-fresh

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

ramadan/custom-fresh
====================

A Laravel package to specify the tables that you do not want to drop while refreshing the database.

v1.2.3(3w ago)571481MITPHPPHP ^8.2

Since May 21Pushed 3w ago1 watchersCompare

[ Source](https://github.com/mahmoudmohamedramadan/custom-fresh)[ Packagist](https://packagist.org/packages/ramadan/custom-fresh)[ Docs](https://github.com/mahmoudmohamedramadan/custom-fresh)[ Fund](https://buymeacoffee.com/mmramadan496)[ GitHub Sponsors](https://github.com/sponsors/mahmoudmohamedramadan)[ RSS](/packages/ramadan-custom-fresh/feed)WikiDiscussions 2.x Synced 3w ago

READMEChangelog (10)Dependencies (3)Versions (29)Used By (0)

Custom Fresh
============

[](#custom-fresh)

[![Custom Fresh](/art/logo.png "Custom Fresh")](/art/logo.png)

[![Latest Version](https://camo.githubusercontent.com/9860ad3396eaf80b4e4a30c5267e0b02b4e659b5a0a6378a62aae378702e3849/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72616d6164616e2f637573746f6d2d66726573683f7374796c653d666c61742d737175617265266c6f676f3d7061636b6167697374)](https://camo.githubusercontent.com/9860ad3396eaf80b4e4a30c5267e0b02b4e659b5a0a6378a62aae378702e3849/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72616d6164616e2f637573746f6d2d66726573683f7374796c653d666c61742d737175617265266c6f676f3d7061636b6167697374)[![Total Downloads](https://camo.githubusercontent.com/eeacc001c52c2c6ea6c530863bb5953f3ffc3e363754d1bbbdfc0eebf7a39d16/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72616d6164616e2f637573746f6d2d66726573683f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/eeacc001c52c2c6ea6c530863bb5953f3ffc3e363754d1bbbdfc0eebf7a39d16/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72616d6164616e2f637573746f6d2d66726573683f7374796c653d666c61742d737175617265)[![PHP](https://camo.githubusercontent.com/b9628818f912d5bac5fd3bddf227fc5bc9da200afb27c14ec745a35bfaebc292/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d3737374242343f6c6f676f3d706870267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/b9628818f912d5bac5fd3bddf227fc5bc9da200afb27c14ec745a35bfaebc292/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d3737374242343f6c6f676f3d706870267374796c653d666c61742d737175617265)[![Laravel](https://camo.githubusercontent.com/520665a81012bd76b2f3f7f8377217ae2ca3a1f2b7abe13212d1c875bfece698/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d25354531302e3025374325354531312e3025374325354531322e3025374325354531332e302d4646324432303f6c6f676f3d6c61726176656c267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/520665a81012bd76b2f3f7f8377217ae2ca3a1f2b7abe13212d1c875bfece698/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d25354531302e3025374325354531312e3025374325354531322e3025374325354531332e302d4646324432303f6c6f676f3d6c61726176656c267374796c653d666c61742d737175617265)[![License](https://camo.githubusercontent.com/9b892129b1f583dcf9f417a58e8dc762016762ef13ce431db44dcb1b7f597cf0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f72616d6164616e2f637573746f6d2d66726573683f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/9b892129b1f583dcf9f417a58e8dc762016762ef13ce431db44dcb1b7f597cf0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f72616d6164616e2f637573746f6d2d66726573683f7374796c653d666c61742d737175617265)

---

Custom Fresh offers fine-grained control over migrations within your Laravel project, enabling you to select which tables will not be dropped when refreshing the database.

Tip

Always consider upgrading the package to the [latest](https://github.com/mahmoudmohamedramadan/custom-fresh/releases/latest) version, which is the most stable release.

- [Installation](#installation)
- [Usage](#usage)
    - [Refreshing migrations](#refreshing-migrations)
    - [Glob patterns](#glob-patterns)
    - [Multiple connections](#multiple-connections)
    - [Dry run](#dry-run)
    - [Configuration](#configuration)
    - [Events](#events)
    - [Example](#example)
- [Credits](#credits)
- [Support me](#support-me)

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

[](#installation)

Install the package by using [Composer](https://getcomposer.org/):

```
composer require ramadan/custom-fresh
```

(Optional) publish the config file:

```
php artisan vendor:publish --tag=custom-fresh-config
```

Usage
-----

[](#usage)

After installing the package, you will see a new `fresh:custom` command.

Note

Since `v1.2.0`, the package scans your migration files more accurately, including nested folders, custom `--path` locations, and package migration paths registered through Laravel.

### Refreshing migrations

[](#refreshing-migrations)

You can exclude specific tables while refreshing the database inside your project:

```
php artisan fresh:custom users,foo
```

The same can be expressed with the `--keep` option (which can be combined with the positional argument):

```
php artisan fresh:custom --keep=users,personal_access_tokens
```

Important

Do not forget always to use the `-h` of the command to check out all supported options.

### Glob patterns

[](#glob-patterns)

Anything containing `*`, `?`, or `[…]` is expanded with `fnmatch` against the database tables, so you can preserve whole groups at once:

```
php artisan fresh:custom "users,oauth_*,telescope_*"
```

### Multiple connections

[](#multiple-connections)

Pass `--database=` to target a non-default connection. The connection is also forwarded to the `migrate` command:

```
php artisan fresh:custom users --database=tenant
```

### Dry run

[](#dry-run)

Use `--explain` to preview exactly what would happen without dropping a single table:

```
php artisan fresh:custom users --explain
```

It prints the resolved connection, the tables that would be preserved, the tables that would be dropped, and the migration rows that would be re-inserted into the `migrations` table.

### Configuration

[](#configuration)

Publishing the config (see above) gives you `config/custom-fresh.php`:

```
return [
    'always_keep' => ['users', 'personal_access_tokens'],
    'patterns'    => ['oauth_*', 'telescope_*'],
    'confirm_in'  => ['production', 'staging'],
];
```

- **`always_keep`** — tables that are preserved on every run, even if you don't list them on the command line.
- **`patterns`** — glob patterns expanded against the database on every run.
- **`confirm_in`** — environments where the command must ask for confirmation. Use `--force` to bypass.

### Events

[](#events)

Three events are dispatched during a run, perfect for backups, audit logs, or Slack notifications:

- `Ramadan\CustomFresh\Events\RefreshingDatabase` — fired before any destructive work, with the resolved preserve list and migration rows.
- `Ramadan\CustomFresh\Events\TablesDropped` — fired right after the drop step, with both the preserved and dropped tables.
- `Ramadan\CustomFresh\Events\DatabaseRefreshed` — fired after the underlying `migrate` finishes successfully.

### Example

[](#example)

[![Custom Fresh CLI Command Example](/art/screenshot.png)](/art/screenshot.png)

Credits
-------

[](#credits)

- [Mahmoud Ramadan](https://github.com/mahmoudmohamedramadan)
- [Contributors](https://github.com/mahmoudmohamedramadan/custom-fresh/graphs/contributors)

Support me
----------

[](#support-me)

- [PayPal](https://paypal.com/paypalme/mmramadan496)

License
-------

[](#license)

The MIT License (MIT).

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance95

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity71

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 ~56 days

Recently: every ~2 days

Total

27

Last Release

26d ago

PHP version history (3 changes)v1.0.6PHP ^8.1

v1.0.7PHP ^8.0

v1.1.8PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b7e0489f88088d2d0a437fb20d6925d593f8212b58f41daffadfebf5f52ab36?d=identicon)[mmramadan496](/maintainers/mmramadan496)

---

Top Contributors

[![mahmoudmohamedramadan](https://avatars.githubusercontent.com/u/48416569?v=4)](https://github.com/mahmoudmohamedramadan "mahmoudmohamedramadan (158 commits)")

---

Tags

composercustom-freshcustom-migratelaravelmariadbmigrationsmssqlmysqloraclepdopgsqlphppostgresqlqueryobjectsqlsqlitesqlserverlaraveldatabasemysqlsqlitepostgresqlmariadbqueryobjectsqlpdopgsqlsqlservermssqloraclemigraterefreshingcustom-fresh

### Embed Badge

![Health badge](/badges/ramadan-custom-fresh/health.svg)

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

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k605.0M6.8k](/packages/doctrine-dbal)[ramadan/easy-model

A Laravel package for enjoyably managing database queries.

111.6k](/packages/ramadan-easy-model)[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4883.1M37](/packages/aura-sqlquery)[ezsql/ezsql

Advance database access library. Make interacting with a database ridiculously easy. An universal interchangeable CRUD system.

86748.3k](/packages/ezsql-ezsql)[moharrum/laravel-adminer

Adminer database management tool for your Laravel application.

451.0k](/packages/moharrum-laravel-adminer)

PHPackages © 2026

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