- Standardizes the process of updating plugins / themes from custom repositories.
- Fully integrates with Plugin / theme info API.
- Easily extendable / customizable
We officially support installing via composer only
composer require oblak/wp-package-updater
Plugin_Updater
and Theme_Updater
are the main abstract classes of the package, and they need to be extended in order to create an updater class.
The class is responsible for registering the plugin / theme update hooks, and for updating the plugin / theme.
At minimum you need to implement the get_update_url()
method, which is responsible for returning the update info URL.
<?php
namespace Vendor\My_Plugin;
use Oblak\WP\Plugin_Updater;
use Oblak\WP\Theme_Updater;
class My_Plugin_Updater extends Plugin_Updater {
protected function get_update_url() {
return 'https://my-plugin.com/api/update';
}
}
class My_Theme_Updater extends Theme_Updater {
protected function get_update_url() {
return 'https://my-theme.com/api/update';
}
}
require_once __DIR__ . 'vendor/autoload.php';
<?php
use Vendor\My_Plugin\My_Plugin_Updater;
use Vendor\My_Plugin\My_Theme_Updater;
new My_Plugin_Updater('plugin-slug');
new My_Theme_Updater('theme-slug');
Depending on your needs, you can override several methods in the updater class to customize the update process according to your repository API.
Some of the functions you can customize:
get_headers
- Returns the headers for the update request.send_request
- Sends the update request to the repository API.validate_response
- Validates the response from the repository API.get_transient_prefix
- Returns the transient prefix for the plugin / theme update information.
Contributions are welcome from everyone. We have contributing guidelines to help you get started.
This project is maintained by Oblak Studio.
This project is licensed under the GNU General Public License v2.0.