A robust Laravel package facilitating automatic updates from GitHub, GitLab, Bitbucket, or custom repositories for your Laravel applications. Supports Laravel version 8 and above.
- Laravel Auto Updater
- Multi-source support: Update from GitHub, GitLab, Bitbucket, or custom repositories
- Simple configuration via environment variables and config file
- Built-in commands for update checks and initiation
- Exclusion of sensitive files/folders from updates
- Comprehensive error handling and logging
- Version tracking through
composer.json
- Global Blade component for easy integration
- API endpoints for programmatic update management
- Configurable middleware for API security
Install the package via Composer:
composer require anisaronno/laravel-auto-updater
Publish the configuration file:
php artisan vendor:publish --tag=auto-updater-config
This creates auto-updater.php
in your config
directory.
Optionally, publish assets and views:
php artisan vendor:publish --tag=auto-updater-assets
php artisan vendor:publish --tag=auto-updater-views
Add these to your .env
file:
RELEASE_URL=https://github.com/anisAronno/laravel-starter
PURCHASE_KEY=your_optional_purchase_key
RELEASE_URL
: Your repository's release URLPURCHASE_KEY
: (Optional) For authenticated APIs or private repos
The config/auto-updater.php
file contains important settings:
- Repository Configuration: The file uses
RepositoryAdapterFactory
to create an appropriate adapter based on yourRELEASE_URL
. - Excluded Items: Define files and folders to exclude from updates.
- Middleware: Specify which middleware to apply to the auto-updater's API endpoints.
Edit the exclude_items
array in config/auto-updater.php
:
"exclude_items" => [
'.env',
'.git',
'storage',
'node_modules',
'vendor',
// Add custom exclusions here
],
To configure the middleware, edit the middleware
array in the config/auto-updater.php
file:
"middleware" => ['web'],
By default, the middleware is set to web
.
Specify your app's version in composer.json
:
{
"version": "1.0.0"
}
After making configuration changes, refresh the config cache:
php artisan config:cache
Check for available updates:
php artisan update:check
Start the update process:
php artisan update:initiate
Add to app/Console/Kernel.php
(Laravel 10 and below):
protected function schedule(Schedule $schedule)
{
$schedule->command('update:initiate')->daily();
}
For Laravel 11+, add to routes/console.php
:
use Illuminate\Support\Facades\Schedule;
Schedule::command('update:initiate')->daily();
The updater warns about modified project files, excluding .env
and storage/
.
For custom update sources, ensure your API returns:
{
"version": "1.0.0",
"download_url": "https://example.com/api/v1/release",
"changelog": "Your changelog text"
}
Access these endpoints for programmatic updates:
- Check for updates:
GET /api/auto-updater/check
- Initiate update:
POST /api/auto-updater/update
These endpoints are protected by the middleware specified in the config file.
Use the global component anywhere in your views:
<x-auto-updater />
We welcome contributions! Please see our Contribution Guide for details.
This package is open-source software licensed under the MIT License.