Composer library for handling WordPress plugin updates from GitHub repositories. Built on yahnis-elsts/plugin-update-checker with built-in rate-limit mitigation.
- Automatic updates from GitHub releases or branch commits.
- Rate-limit mitigation: Configurable check intervals (default 6h) and throttling (72h when update already known).
- GitHub token support for private repos and higher API limits (60 → 5000 requests/hour).
- Release-asset filtering using regex.
- Branch selection (default:
main). - Canonical static API (
GitHubUpdater::init) plus backward-compatible wrapper. - Error handling with
WP_DEBUGlogging.
composer require soderlind/wordpress-github-updaterThis automatically includes yahnis-elsts/plugin-update-checker as a dependency.
- PHP 7.4+
- WordPress plugin context (
ABSPATHmust be defined). - A GitHub repository with releases or branch updates.
use Soderlind\WordPress\GitHubUpdater;
GitHubUpdater::init(
github_url: 'https://github.com/username/plugin-name',
plugin_file: __FILE__,
plugin_slug: 'plugin-name',
name_regex: '/plugin-name\.zip/',
branch: 'main',
check_period: 6, // Hours between checks (default: 6)
auth_token: '', // Optional GitHub token
);Positional equivalent:
\Soderlind\WordPress\GitHubUpdater::init(
'https://github.com/username/plugin-name',
__FILE__,
'plugin-name',
'/plugin-name\.zip/',
'main',
6, // check_period
'' // auth_token
);GitHubUpdater::init(
github_url: 'https://github.com/username/private-plugin',
plugin_file: __FILE__,
plugin_slug: 'private-plugin',
auth_token: defined('MY_PLUGIN_GITHUB_TOKEN') ? MY_PLUGIN_GITHUB_TOKEN : '',
);GitHub_Plugin_Updater is still available for existing integrations.
\Soderlind\WordPress\GitHub_Plugin_Updater::create(
'https://github.com/username/plugin-name',
__FILE__,
'plugin-name',
'main',
6, // check_period
'' // auth_token
);
\Soderlind\WordPress\GitHub_Plugin_Updater::create_with_assets(
'https://github.com/username/plugin-name',
__FILE__,
'plugin-name',
'/plugin-name\.zip/',
'main',
6, // check_period
'' // auth_token
);| Parameter | Required | Default | Description |
|---|---|---|---|
github_url |
Yes | - | Full repository URL (https://github.com/owner/repo) |
plugin_file |
Yes | - | Absolute path to the main plugin file |
plugin_slug |
Yes | - | Plugin slug used by WordPress |
name_regex |
No | '' |
Regex to match release asset zip filename |
branch |
No | 'main' |
Branch to track |
check_period |
No | 6 |
Hours between update checks. Set to 0 to disable automatic checks. |
auth_token |
No | '' |
GitHub personal access token for private repos or higher rate limits |
This library includes built-in protection against GitHub API timeouts/overload:
- Configurable check interval: Default is 6 hours (vs. upstream default of 12h). Adjust via
check_period. - Throttled checks: When an update is already known, checks are reduced to every 72 hours.
- Token authentication: Provide a GitHub token to increase rate limits from 60 to 5000 requests/hour.
- Error logging: API errors are logged when
WP_DEBUGis enabled.
From your main plugin file:
// Autoloaded via Composer
use Soderlind\WordPress\GitHubUpdater;
GitHubUpdater::init(
github_url: 'https://github.com/owner/repo',
plugin_file: __FILE__,
plugin_slug: 'my-plugin',
name_regex: '/my-plugin\.zip/',
branch: 'main',
check_period: 6,
);This repository includes two workflow templates in .github/workflows/:
on-release-add.zip.yml— Release-triggered build + uploadmanually-build-zip.yml— Manual build/upload for a provided tag
Copy them into your plugin repository at .github/workflows/.
- Set
PLUGIN_ZIPto your plugin zip file (example:my-plugin.zip). - Keep
composer install --no-dev --optimize-autoloaderso dependencies are packaged. - Keep the verification step that checks
vendor/yahnis-elsts/plugin-update-checkerexists in the zip. - Ensure
name_regexin PHP matches your zip filename convention.
- Confirm your plugin file, slug, repo URL, and branch are correct.
- Publish a release with an attached zip that matches
name_regex. - Trigger a manual update check in WordPress Admin (or wait for scheduled checks).
If plugin-update-checker is not in vendor/, updater setup fails. In WP_DEBUG, you will see:
GitHubUpdater (your-plugin-slug): Missing dependency yahnis-elsts/plugin-update-checker...
The library includes built-in rate-limit mitigation:
- Check interval: By default, checks only every 6 hours.
- Throttling: When an update is already available, checks reduce to every 72 hours.
- Token auth: Pass a GitHub token via
auth_tokento increase limits from 60 to 5000 requests/hour.
If you still hit rate limits, increase check_period or add a GitHub token.
Pass your GitHub personal access token via the auth_token parameter:
GitHubUpdater::init(
github_url: 'https://github.com/username/private-repo',
plugin_file: __FILE__,
plugin_slug: 'private-plugin',
auth_token: MY_GITHUB_TOKEN,
);WordPress plugins at https://github.com/soderlind
GPL-2.0-or-later.