Skip to content

Adding the WunderUpdates PHP class

To integrate your plugin with WunderUpdates, you'll need to add the latest version of the WunderUpdates PHP class to your WordPress plugin project.

This class is responsible for handling the communication between your user's WordPress site and the WunderUpdates API so that your plugins can check for updates, download new versions, and, if you're using licensed plugins, verify the license key. In short, it's the glue that makes everything work.

Step-by-step

Step 1: Download the class

Download the latest version of class-wp-updates.php from the GitHub repository.

Step 2: Copy the files to your plugin

Copy the two files class-wp-updates.php and popup.php to your plugin directory. You can rename them or place them in the root of your plugin or in a subdirectory, whatever works best for you. But note that the two files must be located in the same directory.

Step 3: Set a new class name

To avoid conflicts with other plugins that may use the same class name, you should rename the class to something unique. We suggest naming the class to match your WunderUpdates account name and plugin slug, for example:

php
class WunderUpdates_abcde123_hello_world {
    // ... The rest of the class is here.
}

Step 4: Configure the class

To configure the class in your plugin, you need to include it and set some options:

php
require_once __DIR__ . '/class-wp-updates.php';
$updates = new WunderUpdates_abcde123_hello_world():
$updates->register( array(
    'plugin_name' => 'Hello World', // The human-readable name of the plugin.
    'version' => '1.0.0',           // The current version of the plugin.
    'slug' => 'hello-world',        // Plugin slug.
    'full_path' => __FILE__,        // Full path to the root plugin file.
    'account_key' => 'abcde123',    // Your WunderUpdates account name/key.
) );

Place this snippet in your root (main) plugin file or in a file that is always included in your main plugin file.

Advanced options

The class can be configured with several options to control how the plugin looks and behaves on the WordPress plugins screen, head over to the WordPress integration options page to learn more about how to configure licenses and update channels.