afragen / git-updater-lite
A simple class to integrate with Git Updater for standalone plugin/theme updates.
Fund package maintenance!
Requires
- php: >=7.4
Requires (Dev)
- phpunit/phpunit: ^9.0
- wp-coding-standards/wpcs: ^3
- yoast/phpunit-polyfills: ^1.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- 3.5.2
- 3.5.1
- 3.5.0
- 3.4.0
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.8.5
- 2.8.4
- 2.8.3
- 2.8.2
- 2.8.1
- 2.8.0
- 2.7.2
- 2.7.1
- 2.7.0
- 2.6.0
- 2.5.0
- 2.3.7
- 2.3.6
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.0
- 1.5.0
- 1.4.5
- 1.4.4
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.1
- 1.3.0
- 1.2.0
- 1.1.0
- 1.0.1
- 1.0.0
- dev-develop
This package is auto-updated.
Last update: 2026-11-21 22:20:48 UTC
README
- Contributors: Andy Fragen
- Tags: plugin, theme, updater, git-updater
- Requires at least: 6.6
- Requires PHP: 7.4
- Donate link: https://thefragens.com/git-updater-donate
- License: MIT
A simple standalone library to enable automatic updates to your git hosted WordPress plugins or themes.
Description
This is version 3.x and contains a breaking changes.
This library was designed to be added to your git hosted plugin or theme to enable standalone updates.
You must have a publicly reachable site that will be used for dynamically retrieving the update API data.
- Git Updater is required on a site where all of the release versions of your plugins and themes are installed.
- All of your plugins/themes must be integrated with Git Updater.
- You must be using Git Updater v13.1.x or better.
Git Updater is capable of returning a REST endpoint containing the plugins_api() or themes_api() data for your plugin/theme. You will pass this endpoint during the integration.
The REST endpoint format is as follows.
- plugins -
https://my-site.com/wp-json/git-updater/v1/update-api/?slug=my-plugin - themes -
https://my-site.com/wp-json/git-updater/v1/update-api/?slug=my-theme
Version 3.0.0 works better with repositories requiring authentication headers using a 2-step process and not exposing the authentication header.
Version 3.2.0 replaces the earlier X-GU-Site-Domain header with a per-site client key. When the client first needs a private package it generates a key locally and sends it as X-GU-Lite-Key (with a display-only X-GU-Client-Label). The update server lists the client as pending; an administrator approves it once on the server's Lite Clients tab. Public packages never send a key and need no configuration. Older clients that send X-GU-Site-Domain are no longer recognized by a current server; see the Git Updater docs for the rollout order.
Version 3.3.0 detects is_private on a successful response and generates the key proactively, instead of waiting for a 403. This lets a site identify itself for approval before enforcement.
Installation
Add via composer. composer require afragen/git-updater-lite:^3
-
Add the
Update URI: <update server URI>header to your plugin or theme headers. Where<update server URI>is the domain to the update server, eghttps://git-updater.com. -
Add the following code to your plugin file or theme's functions.php file.
require_once __DIR__ . '/vendor/afragen/git-updater-lite/Lite.php'; ( new \Fragen\Git_Updater\Lite( __FILE__ ) )->run();
An example integrated plugin is here, https://github.com/afragen/test-plugin-gu-lite
<?php /** * Plugin Name: Test Plugin Git Updater Lite * Plugin URI: https://github.com/afragen/test-plugin-gu-lite/ * Description: This plugin is used for testing functionality of Github updating of plugins. * Version: 0.2.0 * Author: Andy Fragen * License: MIT * Requires WP: 6.6 * Requires PHP: 7.4 * Update URI: https://git-updater.com */ /** * Exit if called directly. */ if ( ! defined( 'WPINC' ) ) { die; } require_once __DIR__ . '/vendor/afragen/git-updater-lite/Lite.php'; ( new \Fragen\Git_Updater\Lite( __FILE__ ) )->run();
Private packages and legacy clients
A Lite client that sends X-GU-Lite-Key keeps working with private packages once its key is
approved. If a consuming plugin or theme cannot be updated to Lite 3.2.0 or newer, deploy the
shim instead of disabling the server gate:
-
Generate a random 256-bit key for the site.
-
Copy
mu/git-updater-lite-key-shim.phpto the site'swp-content/mu-plugins/directory. -
Define the key in
wp-config.php:define( 'GIT_UPDATER_LITE_SHIM_KEY', 'the-per-site-key' );
-
Approve the pending client on the update server's Lite Clients tab (or pre-approve the key with the server-side
git_updater_lite_client_keyfilter). -
Verify a private update succeeds.
The shim adds X-GU-Lite-Key and X-GU-Client-Label to both the update-api and
download-token requests. The key is filterable, so a per-site provisioning layer can set it
without a constant:
add_filter( 'git_updater_lite_shim_key', fn() => 'the-per-site-key' );
Do not authorize a legacy client by domain or IP instead — those are self-asserted or brittle
and reopen the anonymous-download vulnerability. See the Git Updater
docs/private-package-rollout.md for the full rollout order.
Caching
The update API response for each plugin/theme is cached for 6 hours in the
git-updater-lite_{$file} site transient. Change the timeout with the
git_updater_lite_transient_timeout filter.
To refresh sooner, for example right after publishing a new release, go to Dashboard → Updates
and click Check again. The cached data is discarded and refetched for users who can update the
package's type (update_plugins for plugins, update_themes for themes), throttled to once per
minute per package. If the refetch fails, the cached data is kept. It fetches the update server's
current cached data; it does not make the update server re-check the git host.
FWIW, I test by decreasing the version number locally to see an update.