A comprehensive WordPress plugin updater library that enables automatic updates, license verification, and remote plugin management for custom WordPress plugins.
- Automatic Plugin Updates: Seamlessly check for and install plugin updates from your remote server
- License Management: Built-in license key verification and validation system
- Admin Interface: Clean WordPress admin interface for license management
- Plugin Tracking: Track plugin activation, deactivation, and usage statistics
- WordPress Integration: Hooks into WordPress core update system
- Flexible Configuration: Customizable API endpoints, menu placement, and licensing options
- WordPress 5.0 or higher
- PHP 7.4 or higher
- Valid API server endpoint for plugin updates and license verification
composer require shazzad/plugin-updater<?php
// Initialize the updater (autoloaded via Composer)
new \Shazzad\PluginUpdater\Integration(
'https://your-api-server.com/api', // API URL
plugin_basename( __FILE__ ), // Plugin file path
'your-product-id', // Product ID
true, // Enable licensing
true, // Display admin menu
'My Plugin License', // Menu label
'plugins.php', // Parent menu
10 // Menu priority
);/updater/
├── Integration.php # Core functionality and API handling
├── Updater.php # Update checks and WordPress integration
├── Admin.php # WordPress admin interface
└── Tracker.php # Plugin tracking and license sync
| Parameter | Type | Default | Description |
|---|---|---|---|
$api_url |
string | - | Required. Your API server URL |
$product_file |
string | - | Required. Plugin file path (e.g., "my-plugin/my-plugin.php") |
$product_id |
string | - | Required. Unique product identifier |
$license_enabled |
bool | false |
Enable license verification features |
$display_menu |
bool | true |
Show license settings in WordPress admin |
$menu_label |
string | '' |
Custom label for admin menu item |
$menu_parent |
string | '' |
Parent menu slug (defaults to 'plugins.php') |
$menu_priority |
int | 9999 |
Menu display priority |
new \Shazzad\PluginUpdater\Integration(
'https://api.example.com',
plugin_basename( __FILE__ ),
'my-plugin-id'
);new \Shazzad\PluginUpdater\Integration(
'https://api.example.com',
plugin_basename( __FILE__ ),
'my-plugin-id',
true, // Enable licensing
true, // Show admin menu
'My Plugin Updates', // Menu label
'tools.php', // Under Tools menu
20 // Menu priority
);Your API server should provide the following endpoints:
GET /products/{product_id}/updates
Response:
{
"updates": {
"new_version": "2.1.0",
"package": "https://download-url.com/plugin.zip",
"url": "https://plugin-info-url.com",
"tested": "6.4",
"requires": "5.0",
"changelog": "Bug fixes and improvements"
}
}GET /products/{product_id}/details
Response:
{
"details": {
"name": "My Plugin",
"version": "2.1.0",
"author": "Developer Name",
"homepage": "https://plugin-website.com",
"sections": {
"description": "Plugin description",
"changelog": "Version history",
"installation": "Installation instructions"
},
"download_link": "https://download-url.com/plugin.zip"
}
}GET /products/{product_id}/check_license?license=LICENSE_KEY
Response:
{
"license": {
"status": "active",
"expires": "2024-12-31",
"customer_name": "John Doe",
"customer_email": "john@example.com"
}
}GET /products/{product_id}/ping
Used for tracking plugin installations and status.
All API requests include these parameters:
product_version: Current plugin versionproduct_status: Plugin status (active/inactive)wp_url: WordPress site URLwp_locale: WordPress localewp_version: WordPress versionlicense: License key (if licensing enabled)
The updater integrates with WordPress using these hooks:
pre_set_site_transient_update_plugins: Inject update informationplugins_api: Provide plugin details for update screenupgrader_package_options: Configure upgrade processupgrader_process_complete: Handle post-update cleanup- Plugin activation/deactivation hooks for tracking
- License Sync: Hourly cron job to verify license status
- Update Checks: Integrated with WordPress core update system
When licensing is enabled, the updater adds an admin page with:
- License key input field
- License status display
- Update availability notifications
- Direct upgrade buttons
- Changelog and upgrade notices
By default, the license page appears under Plugins menu. You can customize this:
// Under Tools menu
'menu_parent' => 'tools.php'
// Under Settings menu
'menu_parent' => 'options-general.php'
// Top-level menu
'menu_parent' => null- Input Sanitization: All user inputs are properly sanitized
- Nonce Verification: WordPress nonces protect admin forms
- Capability Checks: Requires
delete_userscapability for license management - XSS Protection: Output is escaped using WordPress functions
The updater includes comprehensive error handling:
- API connection failures
- Invalid license keys
- Update server timeouts
- Malformed responses
Errors are logged and displayed appropriately in the WordPress admin.
Enable debugging with the included helper method:
$integration = new \Shazzad\PluginUpdater\Integration(/* ... */);
$integration->p($some_data); // Pretty print data- Refactored into modular structure
- Improved error handling
- Enhanced security measures
- Better WordPress integration
- Comprehensive documentation
For support and bug reports, please contact your plugin developer or visit the plugin's official support channels.
This updater package is typically licensed under the same terms as your main plugin. Check your plugin's license file for specific terms.