PHP code example of madvault / slswc-client

1. Go to this page and download the library: Download madvault/slswc-client 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/ */

    

madvault / slswc-client example snippets


/**
 * Plugin Name  : Test Plugin Name
 * Plugin URI   : https://example.com/plugins/plugin-name
 * Description  : Basic WordPress plugin to test Software License Server for WooCommerce
 * Text Domain  : text_domain
 * Author URI   : https://example.com
 * License      : https://www.gnu.org/licenses/gpl-2.0.html
 * Version      : 1.0.0
 * Author       : Author Name
 * Domain Path  : /languages
 * SLSWC        : plugin
 * Documentation URL: https://www.gnu.org/licenses/gpl-2.0.html
 * Required WP  : 5.8
 * Compatible To: 5.8.1
 */

s();
}

add_action( 'plugins_loaded', 'test_slswc_client_for_plugin', 11 );



use Digitalduz\Slswc\Client\Theme;

function theme_slswc_client() {
    $license_details = array(
        'license_key' => 'LICENSE_KEY',        // Required
        'domain'      => 'THE_CURRENT_DOMAIN', // Optional: will default to WordPress site url.
        'slug'        => 'plugin-slug',        // optional. Will use plugin text domain. Must be the product slug on license server.
    );
    $theme = Theme::get_instance(
        'http://example.com',
        WP_CONTENT_DIR . '/themes/theme-folder-name',
        $license_details
    );
}
add_action( 'wp_loaded', 'theme_slswc_client', 11 );

/*
Theme Name  : Theme Name
Theme URI   : https://example.test/themes/your-theme-name/
Author      : Author Name
Author URI  : https://example.test/
Description : Software License Server for WooCommerce Test Theme
Version     : 1.0
License     : GNU General Public License v2 or later
License URI : http://www.gnu.org/licenses/gpl-2.0.html
Tags        : blog, two-columns, left-sidebar
Text Domain : test-theme
SLSWC       : theme
Documentation URL: https://example.test/docs/test-theme
Tested WP   : 5.8
Requires WP : 5.8.1
*/
require __DIR__ . 'vendor/autoload.php';

$license_server_url = 'http://example.com';
$license_details = array(
    'license_key' => 'LICENSE_KEY', // Required
    'domain' => 'THE_CURRENT_DOMAIN', // Optional: will default to WordPress site url.
    'slug' => 'plugin-slug', // optional. Will use plugin text domain. Must be the product slug on license server.
);

$plugin = Plugin::get_instance( $license_server_url, __FILE__, $license_details );
$plugin->init_hooks();

$license_details = array(
    'license_key' => 'THE_LICENSE_KEY'
);

$theme =  Theme::get_instance( 'http://example.test/', WP_CONTENT_DIR . '/themes/theme-directory-name', $license_details );
$theme->init_hooks();