onstage2426/wp-hub-updater

WordPress plugin and theme updater powered by GitHub releases.

Maintainers

Package info

github.com/onstage2426/wp-hub-updater

pkg:composer/onstage2426/wp-hub-updater

Statistics

Installs: 7

Dependents: 0

Suggesters: 0

Stars: 0

v0.1.9 2026-06-10 11:13 UTC

This package is auto-updated.

Last update: 2026-06-10 11:25:37 UTC


README

PHP 8.3+ WordPress 6.6+ License Packagist Version CI

Delivers WordPress plugin and theme updates from a GitHub repository. Hooks into the standard WordPress update system so your entity appears in the Updates screen and can be installed with a single click.

Installation

composer require onstage2426/wp-hub-updater

Requirements: PHP 8.3+, WordPress 6.6+

Bundling in a plugin? If your plugin ships with this library, prefix the namespace so it can coexist with other plugins that bundle it too. Your release workflow handles this automatically — see Distribution → Namespace isolation.

Quick start

Plugin — call this at the top level of your main plugin file:

use WpHubUpdater\Plugin\PluginUpdater;

$repo = 'https://github.com/your-org/your-plugin';

PluginUpdater::build($repo, __FILE__)
    ->setAccessToken('ghp_xxxx');  // omit for public repos

Theme — call this in functions.php:

use WpHubUpdater\Theme\ThemeUpdater;

$repo = 'https://github.com/your-org/your-theme';

ThemeUpdater::build($repo, 'your-theme')
    ->setAccessToken('ghp_xxxx');  // omit for public repos

That's it. The updater registers its WordPress hooks and handles everything else automatically.

PluginUpdater::build()

PluginUpdater::build(
    string $repositoryUrl,
    string $pluginFile,
    string $slug        = "",   // defaults to filename without .php
    int    $checkPeriod = 12,   // hours between checks; 0 disables automatic checks
    string $optionName  = "",   // defaults to external_updates-{slug}
): static

Pass __FILE__ as $pluginFile from your plugin's main PHP file.

ThemeUpdater::build()

ThemeUpdater::build(
    string $repositoryUrl,
    string $themeSlug,          // theme directory name, e.g. "my-theme"
    int    $checkPeriod = 12,
    string $optionName  = "",
): static

Documentation

  • Configuration — all chainable methods, access token, branch, cooldown, release filters, reading state
  • WordPress filters — filters and actions for info, update, detection strategies, error handling
  • Data classesUpdate, PluginInfo, ThemeInfo properties
  • Distribution — namespace isolation, release pipeline, draft-first workflow, version stamping, ZIP
  • plugin.json / theme.json — metadata schema, changelog, local assets
  • Advanced — MU-plugins, debugging, WP-CLI, reliability features

License

MIT — see LICENSE.