misakstvanu/laravel-subdirectory-migrations

Automatically include all subdirectories in Laravel migration discovery

Maintainers

Package info

github.com/misakstvanu/laravel-subdirectory-migrations

pkg:composer/misakstvanu/laravel-subdirectory-migrations

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-07-23 08:19 UTC

This package is auto-updated.

Last update: 2026-07-23 08:36:50 UTC


README

A super simple Laravel package that changes the migration discovery logic to automatically include all subdirectories under every registered migration path.

Installation

composer require misakstvanu/laravel-subdirectory-migrations

The package auto-discovers itself via Laravel's package discovery, so no manual provider registration is needed.

Usage

Organise your migrations into subdirectories however you like — the package will find them all automatically:

database/
└── migrations/
    ├── 2024_01_01_000000_create_users_table.php
    ├── orders/
    │   ├── 2024_02_01_000000_create_orders_table.php
    │   └── 2024_02_02_000000_create_order_items_table.php
    └── payments/
        └── 2024_03_01_000000_create_payments_table.php

Run migrations as normal:

php artisan migrate

All migration commands (migrate, migrate:rollback, migrate:status, migrate:fresh, etc.) will automatically pick up migrations in subdirectories.

How it works

During the boot phase, SubdirectoryMigrationsServiceProvider recursively walks database/migrations with RecursiveDirectoryIterator and calls loadMigrationsFrom() for every subdirectory found. Laravel's built-in migration commands then discover all those paths automatically. No configuration required.

License

MIT