Menü schliessen
Created: September 25th 2022
Last updated: December 2nd 2026
Categories: IT Development,  Php,  Wordpress
Author: Miljan Puzovic

WordPress: Plugin updater for external (self-hosted) resources

Tags:  github,  package,  PHP,  wordpress

While I was working on internal WP plugin, I had to find a way to automatically check and update that plugin. Therefore, I have created a PHP class PluginUpdater which would make it easy for the whole team to implement on multiple plugins. PluginUpdater has GPL-2.0 licence.

Installation

The package is no longer maintained and its source code is no longer publicly available, so it can't be newly installed. Its documentation can still be found on Packagist. It was included with Composer using:

composer require lexo/plugin-updater

Keep in mind that PluginUpdater requires PHP >=7.4.1 and it's tested up to PHP 8.1.9

Versioning

Release tags are created with Semantic versioning in mind. Commit messages were following convention of Conventional Commits.

Usage example

(new PluginUpdater())
    ->setBasename(BASENAME)
    ->setSlug(PLUGIN_SLUG)
    ->setVersion(VERSION)
    ->setRemotePath('https://website.tld/path/info.json')
    ->setCacheKey(CACHE_KEY)
    ->setCacheExpiration(12 * HOUR_IN_SECONDS)
    ->setCache(true)
    ->run();

For more details you can check out the Packagist page.