Skip to content

Latest commit

 

History

History
72 lines (53 loc) · 1.48 KB

README.md

File metadata and controls

72 lines (53 loc) · 1.48 KB

Appcheap Client Library for Licensing and Update Wordpress Plugin

Requirements

Installation

You can use Composer or simply Download the Release

Composer

The preferred method is via composer. Follow the installation instructions if you do not already have composer installed.

Once composer is installed, execute the following command in your project root to install this library:

composer require appcheap/license:^1.0

Finally, autoloader library in your main plugin file like this:

require_once __DIR__ . '/vendor/autoload.php';

Usage

Initialize the client

$client = new Appcheap\Client([
    'identify' => 'app-builder',
    'base_uri' => 'https://verify.appcheap.io/api/v1',
    'plugin_file' => __FILE__,
]);

Plugin update

$plugin = new Appcheap\Plugin($client);
$plugin->run();

Register license page

$verify = new Appcheap\Verify( $client );

$license_page = $verify->registerLicensePage(
	array(
		'parent_slug' => 'options-general.php',
		'page_title'  => 'License',
		'menu_title'  => 'License',
		'menu_slug'   => 'appcheap-license',
	)
);

Register rest api for license activation and deactivation

$verify = new Appcheap\Verify( $client );

$verify->registerRestApi(
    array(
        'namespace' => 'appcheap/v1',
        'route'     => '/license',
    )
);