| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Composer library for handling WordPress plugin updates from GitHub repositories. Built on yahnis-elsts/plugin-update-checker with built-in rate-limit mitigation.
composer require soderlind/wordpress-github-updaterThis automatically includes yahnis-elsts/plugin-update-checker as a dependency.
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:
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/:
Copy them into your plugin repository at .github/workflows/.
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:
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.
| Back | FazBrowse Home | New Git URL |