anisaronno/laravel-self-updater
Composer 安装命令:
composer require anisaronno/laravel-self-updater
包简介
Laravel Self Updater is a package that helps you to update your Laravel application automatically.
README 文档
README
A robust Laravel package facilitating automatic updates from GitHub, GitLab, Bitbucket, or custom repositories for your Laravel applications.
Supports Laravel version 10 and above.
Table of Contents
- Laravel Self Updater
Features
- Multi-source Support: Update from GitHub, GitLab, Bitbucket, or custom repositories
- Simple Configuration: Easy setup via environment variables and config file
- Built-in Commands: Convenient commands for update checks and initiation
- File Exclusion: Protect sensitive files/folders during updates
- Error Handling: Comprehensive logging and error management
- Version Tracking: Utilizes
composer.jsonfor version management - UI Integration: Global Blade component for easy frontend implementation
- API Endpoints: Programmatic update management
- Security: Configurable middleware for API protection
- Composer Integration: Optional management of Composer dependencies during updates
- Extensibility: Support for custom VCS providers
Installation
-
Install the package via Composer:
composer require anisaronno/laravel-self-updater
-
Publish the configuration file:
php artisan vendor:publish --tag=self-updater-config
This creates
self-updater.phpin yourconfigdirectory. -
(Optional) Publish assets and views:
php artisan vendor:publish --tag=self-updater-assets php artisan vendor:publish --tag=self-updater-views
Configuration
Environment Variables
Add these to your .env file:
RELEASE_URL=https://github.com/anisAronno/laravel-starter LICENSE_KEY=your_optional_purchase_key
RELEASE_URL: Your repository's release URLLICENSE_KEY: (Optional) For authenticated APIs or private repos
Config File
The config/self-updater.php file contains important settings:
- Repository Configuration: Uses
VCSProviderFactoryto 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 self-updater's API endpoints.
- Composer Dependencies: Configure whether to run Composer install or update during the update process.
Excluding Items from Updates
Edit the exclude_items array in config/self-updater.php:
"exclude_items" => [ '.env', '.git', 'storage', 'node_modules', 'vendor', // Add your custom exclusions here ],
Setting Middleware
Configure the middleware in config/self-updater.php:
"middleware" => ['web'],
Application Version
Specify your app's version in composer.json:
{
"version": "1.0.0"
}
Composer Dependencies
Configure Composer behavior during updates in config/self-updater.php:
'require_composer_install' => false, 'require_composer_update' => false,
Set these to true to run Composer install or update respectively during the update process.
Custom VCS Providers
Extend functionality with custom VCS providers:
use AnisAronno\LaravelSelfUpdater\Services\VCSProvider\VCSProviderFactory; // Register a new provider VCSProviderFactory::registerProvider('custom-vcs.com', YourCustomVCSProvider::class); // Remove a provider VCSProviderFactory::removeProvider('custom-vcs.com'); // Check if a provider is registered $isRegistered = VCSProviderFactory::hasProvider('custom-vcs.com'); // Get all registered providers $providers = VCSProviderFactory::getProviders();
Ensure your custom provider implements VCSProviderInterface.
After configuration changes, refresh the config cache:
php artisan config:cache
Usage
Checking for Updates
Run the following command to check for available updates:
php artisan update:check
Initiating Updates
To start the update process, use:
php artisan update:initiate
Scheduling Automatic Updates
For Laravel 10, add to app/Console/Kernel.php:
protected function schedule(Schedule $schedule) { $schedule->command('update:initiate')->dailyAt('01:00'); }
For Laravel 11+, add to routes/console.php:
use Illuminate\Support\Facades\Schedule; Schedule::command('update:initiate')->dailyAt('01:00');
Handling Modified Files
The updater will warn about modified project files, excluding .env and storage/.
Custom Update Sources
For custom update sources, ensure your API returns:
{
"version": "1.0.0",
"download_url": "https://example.com/api/v1/release",
"release_date": "01-02-2024",
"changelog": "Your changelog text"
}
API Integration
Access these endpoints for programmatic updates:
- Check for updates:
GET /api/self-updater/check - Initiate update:
POST /api/self-updater/update
These endpoints are protected by the middleware specified in the config file.
Blade Component
Use the global component in your views:
<x-self-updater />
Contributing
We welcome contributions! Please see our Contribution Guide for details.
License
This package is open-source software licensed under the MIT License.
anisaronno/laravel-self-updater 适用场景与选型建议
anisaronno/laravel-self-updater 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 315 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 10 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「package」 「laravel」 「updater」 「self-updater」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 anisaronno/laravel-self-updater 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 anisaronno/laravel-self-updater 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 anisaronno/laravel-self-updater 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Migration generator for Yii 2.
A simple class to integrate with Git Updater for standalone plugin/theme updates.
A module to backup and update SimpleSAMLphp installations
Simple ASCII output of array data
eZ Update offers composer package(s) updates - Use this feature to update your website to the latest available release via composer
统计信息
- 总下载量: 315
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-17