jcodigital/jcore-update 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jcodigital/jcore-update

Composer 安装命令:

composer require jcodigital/jcore-update

包简介

Composer-installable WordPress plugin updater integration for the JCORE Update API.

README 文档

README

Composer-installable WordPress library for integrating plugin updates with the JCORE Update API.

Install

composer require jcodigital/jcore-update

Quickstart

use Jcore\Update\Config\UpdateConfig;
use Jcore\Update\Hooks\PluginUpdateHooks;
use Jcore\Update\Support\PluginHelper;

$config = new UpdateConfig(
    pluginFile: __FILE__,
    slug: 'my-plugin-slug',
    version: PluginHelper::getVersion(__FILE__),
    apiBaseUrl: 'https://api.example.com/v1',
    licenseKey: get_option('my_plugin_license_key') ?: null,
);

$updater = new PluginUpdateHooks($config);
$updater->register();

Full example plugin bootstrap

See examples/wordpress-plugin-bootstrap.php for a complete example including:

  • updater registration
  • license option storage
  • settings page form
  • validateLicense() usage in a sanitize callback

License validation (headless)

This library validates keys against POST /v1/licenses/validate but intentionally does not render any UI.

$result = $updater->validateLicense($licenseKey);

if ($result->isSuccess() && $result->valid) {
    // persist valid state in your plugin
} else {
    // show error/notice in your plugin UI
}

Convenience helper:

$isValid = $updater->isLicenseValid($licenseKey);

Notes

  • GET /v1/update-check is used for update checks and plugin detail payloads.
  • 204 No Content is treated as a valid “no update” state.
  • License keys are never stored in cache keys directly (hashes are used).
  • UI elements (settings pages, admin notices, forms) remain the host plugin’s responsibility.

Development

Code Quality

Run phpcs to check coding standards:

composer lint

To automatically fix most coding standard issues:

composer fix

Testing

The library uses PHPUnit for testing. Run the tests with:

composer test

统计信息

  • 总下载量: 79
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 6
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2026-05-27