badabingbreda / githubupdater
轻松更新GitHub托管插件
1.0.0
2024-08-27 16:22 UTC
README
使用此类来使您的插件在GitHub上检查更新。
添加自定义插件头部
您可以为插件添加自定义头部以使其看起来更美观。将以下内容添加到发布说明中,它们将用作每个更新设置的值
Tested: 6.3
Icons: 1x|https://domainname.com/icon-256x256.png?rev=2818463,2x|https://domainname.com/icon-256x256.png?rev=2818463
Banners: low|https://domainname.com/banner-720x250.png,high|https://domainname.com/banner-1440x500.png
RequiresPHP: 7.0
|||
Add your changelog here
发布格式
请确保使用正确的发布格式来指示有更新。草拟一个发布并添加一个x.y.z格式的标签。例如
1.0.0
1.1.0
1.21.3
2.4.9
所有良好的版本。
使用更新器
第一步是创建GitHub上插件的一个发布。您可以草拟一个发布,添加一个'tag' '1.0.0'并确认。
从您的插件目录通过Composer添加类
composer require badabingbreda/githubupdater
确保在主插件文件中包含自动加载。
// load our Composer autoload
require_once( 'vendor/autoload.php' );
在您的插件中添加以下内容
$github_updater = new \BadabingBreda\GithubUpdater(__FILE__ , 'yourusername' , 'repository-slug' );
$github_updater->set_settings([
'requires' => '7.4',
'tested' => '6.3',
]);
$github_updater->initialize();
或者,当您接受默认设置时
$githubupdater = (new \BadabingBreda\GithubUpdater( __FILE__ , 'yourusername' , 'repository-slug' ))->initialize();