PHPackages                             mnabialek/laravel-quick-migrations - 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. mnabialek/laravel-quick-migrations

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

mnabialek/laravel-quick-migrations
==================================

Run Laravel tests quicker

v1.2.4(2y ago)2210.9k4MITPHPCI failing

Since Jul 23Pushed 2y ago1 watchersCompare

[ Source](https://github.com/mnabialek/laravel-quick-migrations)[ Packagist](https://packagist.org/packages/mnabialek/laravel-quick-migrations)[ RSS](/packages/mnabialek-laravel-quick-migrations/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (5)Versions (8)Used By (0)

Laravel Quick Migrations
========================

[](#laravel-quick-migrations)

[![Build Status](https://camo.githubusercontent.com/e03d196898b51232c69f33bd3c28dcf98cdea1513ce03e2e88cb8831dc98458e/68747470733a2f2f7472617669732d63692e6f72672f6d6e616269616c656b2f6c61726176656c2d717569636b2d6d6967726174696f6e732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mnabialek/laravel-quick-migrations)[![Coverage Status](https://camo.githubusercontent.com/3c14e7594784f8dc538f922c24adb2501a0ead1da4d521b5250675baaeaab322/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d6e616269616c656b2f6c61726176656c2d717569636b2d6d6967726174696f6e732f62616467652e737667)](https://coveralls.io/github/mnabialek/laravel-quick-migrations)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/8d659b78137983a891ca201268cbf3726b21e93a506ac5e881027b2aa5759218/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6e616269616c656b2f6c61726176656c2d717569636b2d6d6967726174696f6e732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mnabialek/laravel-quick-migrations/)[![Packagist](https://camo.githubusercontent.com/63c27bb4365c0eb8cc6950335454feee7c8b4c74b2f0f3ed3a362d8bcc916376/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6e616269616c656b2f6c61726176656c2d717569636b2d6d6967726174696f6e732e737667)](https://packagist.org/packages/mnabialek/laravel-quick-migrations)

This package is intended to **improve speed of Laravel tests that needs to use migrations**. In case you use Laravel's `DatabaseMigrations` trait (especially in Browser tests) you might be interested in using this package to save a lot of time.

Be aware this package doesn't improve speed of normal migrations you apply to database - it should be used only if have tests in your application and you want to improve their speed.

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

[](#installation)

1. Run

    ```
    composer require mnabialek/laravel-quick-migrations --dev
    ```

    in console to install this module (Notice `--dev` flag - it's recommended to use this package only for development).
2. Run:

    ```
    php artisan vendor:publish
    ```

    and choose the number matching `"Mnabialek\LaravelQuickMigrations\Providers\ServiceProvider"` provider.

    By default you should not edit published file because all the settings are loaded from `.env` file by default.

    Depending on your needs you might add now into `.env` (or other env files used for tests):

    ```
    QUICK_MIGRATIONS_ENABLED=true
    QUICK_MIGRATIONS_DUMP_FILE="/custom/directory/custom_filename.sql"
    ```

    and customize it with your own values. Keep if mind if you set `QUICK_MIGRATIONS_ENABLED` you will automatically use default Laravel migrations again.
3. Update all your tests where you use `DatabaseMigrations` trait with `QuickDatabaseMigrations`. You should add import line into those files too:

    ```
    use Mnabialek\LaravelQuickMigrations\QuickDatabaseMigrations;
    ```
4. Run:

    ```
    php artisan migrate:fresh --database=selected_sql_connection
    ```

    into empty database. Of course as `selected_sql_connection` you should use connection you really use in your app (usually `mysql` or `mysql_testing`).

    Now you can manually dump structure of this database into single file (or use `mysqldump`) and save file as `storage/tests/dump.sql` (If you set custom value of `QUICK_MIGRATIONS_DUMP_FILE` in your env file then you should of course put it into your custom location)
5. Run your tests and enjoy!

Benchmarks
----------

[](#benchmarks)

My test suite (real application) had 53 Laravel Dusk tests with 890 assertions running in Docker container. Database had 93 migrations.

RunDatabaseMigrationsQuickDatabaseMigrationsDifference1st24.7 min (28s/test)8.29 min (9.4s/test)16.41 min (**2.98 times faster**)2nd25.08 min (28.4s/test)9.23 min (10.45s/test)15.85 min (**2.72 times faster**)3rd24.37 min (27.57s/test)7.92 min (8.97s/test)16.45 min (**3.08 times faster**)As you see in real-application scenario difference is quite impressive. Using modified trait makes tests running almost 3 times faster comparing to original tests.

Of course in your case results might be different. A lot of depends on migrations you have in your app - how long they take by default. For example assuming you have 100 tests using migrations and applying your migrations takes 10 seconds (for each test) and using your dump would take 6 seconds (for each test) then you would save 100 \* 4 seconds that gives 6.66 minutes each time you are running your tests. As you see in my scenario difference was much bigger.

Cons
----

[](#cons)

- You need to manually update dump whenever you add/change migrations. But assuming you are using tests it might be really worth it to spend &lt; 1 minute for dumping fresh migrations to save hundreds of minutes.
- After running tests in your database you have data you created during your tests. From my point of view, if you are using database for tests only you should not care much about it. But of course you can create command that will always remove everything from your database after completing tests if you really need it.

### Authors

[](#authors)

Author of this package is **[Marcin Nabiałek](http://marcin.nabialek.org/en/)** and [Contributors](https://github.com/mnabialek/laravel-quick-migrations/graphs/contributors)

### Changes

[](#changes)

All changes are listed in [Changelog](CHANGELOG.md)

### License

[](#license)

This package is licenced under the [MIT license](LICENSE).

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 96% 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 ~345 days

Recently: every ~364 days

Total

7

Last Release

784d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/75e68c5eb4daa861595caa21f3d4c6f94ff25118535bc8eac93648b095eab307?d=identicon)[mnabialek](/maintainers/mnabialek)

---

Top Contributors

[![mnabialek](https://avatars.githubusercontent.com/u/7656807?v=4)](https://github.com/mnabialek "mnabialek (24 commits)")[![scottbedard](https://avatars.githubusercontent.com/u/7980426?v=4)](https://github.com/scottbedard "scottbedard (1 commits)")

---

Tags

laravellaravel migrationslaravel dusk speedlaravel dusk performancelaravel migrations performance

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/mnabialek-laravel-quick-migrations/health.svg)

```
[![Health](https://phpackages.com/badges/mnabialek-laravel-quick-migrations/health.svg)](https://phpackages.com/packages/mnabialek-laravel-quick-migrations)
```

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