shalvah/upgrader
Automate upgrading users’ PHP library config files when releasing new versions. Compare old vs sample new config, apply moves/renames and ignored keys, support dot notation, preview changes with dry-run, and create a .bak backup before upgrading.
composer require shalvah/upgraderphp artisan vendor:publish --provider="Shalvah\Upgrader\UpgraderServiceProvider" (creates config/upgrader.php)php artisan make:upgrade AddUserPreferences — this generates a class in app/Upgrades/up() method in the generated class to apply changes (e.g., populate a new column, seed config, cleanup stale data)php artisan upgrader:run — executes pending upgrades in version order🔍 First use case: Migrating legacy data after adding a new required column — where Eloquent model validation/migrations alone can’t safely handle mass updates.
2024_03_15_120000_add_user_timezone) — lexicographic ordering ensures correct sequence2024_02_01_000000_migrate_old_settings_to_json.php + 2024_02_01_000001_populate_default_timezone.php)upgrader for data transitions (e.g., splitting a name column into first_name/last_name)up() as a single atomic operation or a series of safe conditionals (if (!Schema::hasColumn('users', 'timezone')) { ... })php artisan upgrader:run to your deployment script after migrations but before app restarts/caches clearconfig('upgrader.dry_run', true) to preview which classes would rundown() or rollback — plan ahead and log enough info to manually revert if neededup() throws an exception mid-execution, the upgrade is not marked as completed (safe), but you’ll need to inspect logs — ensure your up() is wrapped in try/catch for non-critical steps2024_03_01_999999 before 2024_03_02_000000)upgrader:run twice — verify no side effects on re-runUpgrader::getCompleted() in your up() logic to conditionally handle edge casesDB facade or Eloquent)file in clustered environmentsHow can I help you explore Laravel packages today?