Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Upgrader Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Upgrader

Latest Stable Version Total Downloads

Releasing a new version of your PHP library with changes to the config file? Use this tool to offer an automated upgrade process to your users. Used for implementing automated upgrades in Scribe — just run php artisan scribe:upgrade.

Give Upgrader a sample of your new config file, and the path to the user's old config file, and it'll figure out what's been added or removed in the new version. You can also tell it to move/rename certain fields or ignore others.

// Create a CLI `upgrade` command, where you call Upgrader

// Relative path to the config file in the user's project
$userOldConfigFile = 'config/my_library.php'; 
// Absolute path to a sample of the new config in your project
$sampleNewConfigFile = __DIR__ . '/../../config/my_library.php';

$upgrader = Upgrader::ofConfigFile($userOldConfigFile, $sampleNewConfigFile)
  ->move('path', 'static.path')
  ->dontTouch('ip_addresses');
   
   // If this is a dry run, print the expected changes
   if ($this->option('dry-run')) {
     $changes = $upgrader->dryRun();
     if (empty($changes)) {
       $this->info("No changes needed! Looks like you're all set.");
       return;
     }
     
     $this->info('The following changes will be made to your config file:');
     
     foreach ($changes as $change) {
       $this->info($change["description"]);
     }
     
     return;
}

// Otherwise, run the upgrade 🚀
$upgrader->upgrade();

Upgrader:

  • Comes with "dry run" functionality, so you can review expected changes.
  • Will back up the user's old config file to {$file}.bak so you can revert if you need to.
  • Supports keys as dot notation

Upgrader is still early days (0.x), with more robust features and docs planned. Read how I built it here.

Installation

PHP 8+ is required.

composer require shalvah/upgrader
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport