salahhusa9/laravel-updater
Update your Laravel 10/11/12 app with a single command or click. Laravel Updater streamlines project updates with an easy setup and docs, plus built-in tests and ongoing maintenance for smoother upgrades.
Install the package via Composer (now supports Laravel 11, 12, and 13):
composer require salahhusa9/laravel-updater
No service provider or config publishing is required—the package auto-registers. Run php artisan list and verify the updater:check and updater:update commands are available. For the simplest first use, check for updates:
php artisan updater:check
This scans your app’s git repository (or configured source) and reports if a newer version is available. To perform an actual update:
php artisan updater:update
The command performs git fetch, git checkout, and runs composer install by default—ideal for development and staging environments.
Note for Laravel 13 users: Ensure your project meets the updated PHP version requirements (now aligned with Laravel 13’s defaults).
CI/CD Integration (Updated for Laravel 13):
Use the updater:update command in your deployment pipeline (e.g., GitHub Actions, Deployer) after pulling the latest code. For Laravel 13 projects, ensure your CI environment matches the updated PHP version requirements. Example:
php artisan updater:update --force
The --force flag bypasses confirm prompts for non-interactive environments like CI/CD.
Before/After Hooks:
Define custom pipeline steps via configuration or event listeners. The package merges custom beforeUpdate() and afterUpdate() pipelines with built-in steps (e.g., composer install, migrate, config:cache). Configure via config/updater.php or environment variables:
UPDATER_BEFORE=publish,clear-caches
UPDATER_AFTER=optimize,send-notification
Custom pipelines can be artisan commands or closures registered via the Updater facade. Laravel 13 users: Ensure your custom hooks are compatible with Laravel 13’s updated service container and event system.
Version Comparison Strategy:
Configure how versions are compared (e.g., using tags, branches, or SHA) in config/updater.php. Adjust the version_strategy to 'tag', 'branch', or 'sha' to align with your release process. This remains unchanged but is critical for Laravel 13 projects using semantic versioning or GitHub Releases.
GUI Access (Optional):
Wrap updater:check in a controller method guarded by app()->isLocal() or role-based middleware for quick manual updates in dev. Ensure your middleware is compatible with Laravel 13’s updated authentication system if applicable.
Git State Matters (Laravel 13 Compatibility):
The updater performs a hard reset (git checkout -f). Any local modifications (e.g., .env changes, debug code) will be lost unless excluded via .git/info/exclude or .gitignore. Tip for Laravel 13: If using Laravel’s new .env.example or .env.testing files, ensure they are committed to Git to avoid losing configurations during updates.
No Auto-Migrations by Default:
While migrate is in the default afterUpdate pipeline, it only runs if the environment allows it (APP_ENV not in UPDATER_BLOCK_ENVS). Confirm or adjust config/updater.php to avoid unintended production migrations. Laravel 13 Note: If using Laravel’s new migration optimizations, ensure your afterUpdate pipeline includes migrate:fresh --env=testing for test environments if needed.
Security Considerations (Updated Dependencies):
The package now includes updated dependencies (e.g., dependabot/fetch-metadata, actions/setup-node). While these are non-breaking, audit your composer.json and restrict repository sources using COMPOSER_REPO or private repository auth in the environment. Laravel 13: Ensure your composer.json aligns with Laravel 13’s updated dependency constraints.
Command Output Verbosity:
Use -v, -vv, or -vvv flags to increase detail during debugging (e.g., if Composer install fails silently). For Laravel 13, this is especially useful if encountering issues with the updated PHP version or Composer 2.x.
Configuration Override:
While config/updater.php is published automatically, you can override any setting at runtime:
config(['updater.force' => true]);
Artisan::call('updater:update');
Laravel 13: Ensure your overrides are compatible with Laravel’s updated configuration system (e.g., no deprecated config() method usage).
Testing Safely:
The package includes a mock git repository helper. In tests, set config('updater.mock', true) to avoid actual git operations during feature tests of your updater pipeline. Laravel 13: Use Laravel’s new Pest testing framework or updated PHPUnit version if available in your project.
Laravel 13-Specific Considerations:
beforeUpdate/afterUpdate pipelines should use Laravel 13’s updated Artisan helpers (e.g., command() method changes).How can I help you explore Laravel packages today?