Composer-installable WordPress library for integrating plugin updates with the JCORE Update API.
composer require jcodigital/jcore-updateuse 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();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
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);GET /v1/update-checkis used for update checks and plugin detail payloads.204 No Contentis 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.
Run phpcs to check coding standards:
composer lintTo automatically fix most coding standard issues:
composer fixThe library uses PHPUnit for testing. Run the tests with:
composer test