PHP code example of abdullahkaram-dev / laravel-migration-sorter

1. Go to this page and download the library: Download abdullahkaram-dev/laravel-migration-sorter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

abdullahkaram-dev / laravel-migration-sorter example snippets


protected $commands = [
    \AbdullahKaramDev\MigrationSorter\Commands\SortingMigration::class,
];
bash
php artisan rearrange-migrations

database/migrations/
├── 2023_01_15_120000_create_users_table.php
├── 2024_03_20_140000_create_posts_table.php
├── 2024_01_10_100000_create_categories_table.php
└── 2024_02_28_160000_add_foreign_keys.php

database/migrations/
├── 2025_07_02_120000_create_users_table.php      # Original: 2023_01_15
├── 2025_07_02_120001_create_categories_table.php # Original: 2024_01_10
├── 2025_07_02_120002_add_foreign_keys.php        # Original: 2024_02_28
└── 2025_07_02_120003_create_posts_table.php      # Original: 2024_03_20

storage/app/migration_backups/
└── 2025-07-02_14-30-15/
    ├── 2023_01_15_120000_create_users_table.php
    ├── 2024_01_10_100000_create_categories_table.php
    ├── 2024_02_28_160000_add_foreign_keys.php
    └── 2024_03_20_140000_create_posts_table.php