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)
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-11 21:49:39 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. It can also be set in Git Updater to use domain validation.
Version 3.1.0 sends the requesting site's own domain (X-GU-Site-Domain) on the update-api request, in addition to the existing download-token request. This lets an update server authorize a specific site for a private package on the metadata route. If you distribute private packages, your update server's Git Updater must be new enough to enforce this, and each client site's domain must be listed on the server's Lite Client Domains tab — otherwise the server withholds the package and updates stop for that site. See the Git Updater docs for the rollout order; older clients send no headers on update-api and cannot be authorized for private packages.
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();
FWIW, I test by decreasing the version number locally to see an update.