PHP code example of zion / wordpress-license-sdk

1. Go to this page and download the library: Download zion/wordpress-license-sdk 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/ */

    

zion / wordpress-license-sdk example snippets


$licenseManager->activate($licenseKey);
$status = $licenseManager->validateLicense();
$licenseManager->deactivate();

$status = $licenseManager->status();

if ($status['license_state'] === 'updates_only') {
    // Site-ul este înregistrat pentru update-uri fără licență comercială.
    $this->showFreeUpdatesBadge();
}

$config = new Config(
    apiUrl: 'https://license.zion3d.ro/api/v1',
    productSlug: 'demo-plugin',
    pluginFile: __FILE__,
    productKey: 'zion_public_product_key',
    updatePublicKey: 'BASE64_ED25519_PUBLIC_KEY',
    updateKeyId: 'default',
    

$status = $licenseManager->updateStatus();

if ($status['available']) {
    echo esc_html($status['latest_version']);
}

if (current_user_can('update_plugins')) {
    $result = $licenseManager->updateIfAvailable();
}

if ($licenseManager->allows('analytics')) {
    $this->registerAnalytics();
}

$status = $licenseManager->status();
// $status['plan'] === 'pro'
// $status['entitlements']['multiple_templates'] === true

$gate = $licenseManager->featureGate();

if ($gate->allows('white_label')) {
    $this->enableWhiteLabel();
}