PHP code example of ideologix / dlm-wp-updater

1. Go to this page and download the library: Download ideologix/dlm-wp-updater library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ideologix / dlm-wp-updater example snippets




use \IdeoLogix\DigitalLicenseManagerUpdaterWP\Main;

try {
    $instance = new Main( array(
        'id'              => 'The software ID',
        'name'            => 'The software Name',
        'file'            => '/path/to/wp-content/plugins/your-plugin/your-plugin.php', // Tip: use __FILE__ to define it in your-plugin.php
        'basename'        => 'your-plugin/your-plugin.php', // Tip: use plugin_basename( __FILE__ ) in your-plugin.php
        'version'         => YOUR_PLUGIN_VERSION, // Tip: Define this in your-plugin.php file and increment with every release.
        'url_settings'    => 'https://url-to-your-plugin/settings-page',
        'url_purchase'    => 'https://url-to-your-website/purchase-page',
        'consumer_key'    => 'ck_XXXXXXXXXXXXXXXXX',
        'consumer_secret' => 'cs_XXXXXXXXXXXXXXXXX',
        'api_url'         => 'https://yourwoocommercesite.com/wp-json/dlm/v1/',
        'prefix'          => 'dlm',
    ) );
} catch (\Exception $e) {
    error_log('Error: ' . $e->getMessage());
}

// Important: To display the activation form in your settings page (url_settings), use the renderActivationForm() method like bellow.
// Note: If you want to override the activation form, you can extend the Activator class with your own class and override the renderActivationForm() method.
$instance->getActivator()->renderActivationForm();