PHPackages                             oberonlai/wp-updater - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. oberonlai/wp-updater

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

oberonlai/wp-updater
====================

Self hosted WordPress plugin update server

v1.0.3(1y ago)2121MITPHPPHP &gt;=7.2

Since Jul 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/oberonlai/wp-updater)[ Packagist](https://packagist.org/packages/oberonlai/wp-updater)[ Docs](https://github.com/oberonlai/wp-updater)[ RSS](/packages/oberonlai-wp-updater/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

WP Updater v1.0
===============

[](#wp-updater-v10)

> Simple WordPress Class for self host plugin updating server

from [How to Configure Self-Hosted Updates for Your Private Plugins](https://rudrastyh.com/wordpress/self-hosted-plugin-update.html)

Requirements
------------

[](#requirements)

- PHP &gt;=7.2
- [Composer](https://getcomposer.org/)
- [WordPress](https://wordpress.org) &gt;=5.4

Installation
------------

[](#installation)

#### Install with composer

[](#install-with-composer)

Run the following in your terminal to install with [Composer](https://getcomposer.org/).

```
$ composer require oberonlai/wp-updater

```

WP Metabox [PSR-4](https://www.php-fig.org/psr/psr-4/) autoloading and can be used with the Composer's autoloader. Below is a basic example of getting started, though your setup may be different depending on how you are using Composer.

```
require __DIR__ . '/vendor/autoload.php';

use ODS\Updater;

$options = array( ... );

$books = new Updater( $options );
```

See Composer's [basic usage](https://getcomposer.org/doc/01-basic-usage.md#autoloading) guide for details on working with Composer and autoloading.

Basic Usage
-----------

[](#basic-usage)

Below is a basic example of setting up a plugin updater.

```
// Require the Composer autoloader.
require __DIR__ . '/vendor/autoload.php';

// Import PostTypes.
use ODS\Updater;
```

Usage
-----

[](#usage)

To create a updater, first instantiate an instance of `Updater`. The class takes one argument, which is an associative array.

```
$updater = new Updater( array(
	'plugin_slug' => 'my-plugin',
	'version'     => '1.0.0',
	'json_url'    => 'https://mydomain.com/my-plugin.json',
));
```

License Manger
--------------

[](#license-manger)

You can add the license argument when creating the Updater instance. The license key is used to verify the authenticity of the plugin. The license key is stored in the database and is used to verify the authenticity of the plugin.

```
$updater = new Updater( array(
    'plugin_slug' => 'my-plugin',
    'version'     => '1.0.0',
    'json_url'    => 'https://mydomain.com/my-plugin-validate.php',
    'license'     => get_option( 'my-plugin_license_key' ),
));
```

In the my-plugin-validate.php file, you can add the following code to verify the license key.

```
