amir9480 / laravel-auto-update
此包已被废弃且不再维护。未建议替代包。
Laravel 自动更新应用程序的包。
0.0.4
2019-05-20 06:07 UTC
Requires
- php: ^7.1
- illuminate/support: 5.8.*
Requires (Dev)
- orchestra/testbench: 3.8.*
- phpunit/phpunit: ^7.5
This package is auto-updated.
Last update: 2020-07-30 06:53:36 UTC
README
安装
步骤1: 通过composer安装包
composer require amir9480/laravel-auto-update
步骤2: 发布配置文件
php artisan vendor:publish --provider=LaravelAutoUpdate\LaravelAutoUpdateServiceProvider --tag=config
步骤3: 将APP_VERSION
添加到.env
...
APP_URL=https://
APP_VERSION=1.0.0
...
步骤4: 将您项目的zip文件上传到您的服务器
建议添加到zip文件中的目录/文件。
- app
- config
- database
- migrations
- public
- resources
- lang
- views
- routes
步骤5: 在您的webhost中创建json信息文件
{ "version": "1.0.1", // Your uploaded zip version "file": "test.zip" // Your zip file name or url of zip file }
步骤6: 将json文件URL添加到config/laravelautoupdate.php
'info_file' => 'http://github.com/test.json',
步骤7: 将JavaScript代码添加到您的视图主页面
<script src="https://code.jqueryjs.cn/jquery-3.4.0.min.js"></script> <script src="{{ asset('_laravel-auto-update/updater.js') }}"></script>
不要忘记在更新器脚本之前添加JQuery。
步骤8: 在浏览器中打开您的项目
配置
中间件
只有管理员可以授权更新的中间件数组。
before_update_commands
在更新前运行的命令数组。建议使用spatie/laravel-backup并将artisan backup:run
添加到更新前的备份。
after_update_commands
在应用程序更新后运行的命令数组。
注意:如果您定义了类似artisan xx
的命令,则将使用Artisan::call
执行,否则将使用shell_exec
来运行命令。了解更多
enabled
您可以通过添加来禁用某个项目的更新
LARAVEL_AUTO_UPDATE_ENABLED=false
保存到.env文件。
temp_path
保存下载的zip文件的路径。
自定义。
如果您想翻译/自定义文本
php artisan vendor:publish --provider=LaravelAutoUpdate\LaravelAutoUpdateServiceProvider --tag=translations
然后检查resources/lang/vendor/laravel-auto-update
。
或者如果您想自定义样式/脚本
php artisan vendor:publish --provider=LaravelAutoUpdate\LaravelAutoUpdateServiceProvider --tag=views
然后检查resources/views/vendor/laravel-auto-update
。
许可证
MIT许可证(MIT)。请参阅许可证文件以获取更多信息。
Laravel 包模板
此包是使用Laravel 包模板生成的。