A PHP library which implements the functionality of the Craftnet API. See the Craftnet API documentation for all available settings.
Add the library to your project via composer:
{
"require": {
"barrelstrength/craftnet-php": "{version}"
}
}
Require the library in your project:
require __DIR__ . '/vendor/autoload.php';
To authenticate with Craftnet set your username
and apiKey
values when instantiating a new CraftnetClient
class.
use barrelstrength\craftnetphp\CraftnetClient;
$username = 'USERNAME';
$apiKey = 'API_KEY;
$client = new CraftnetClient($username, $apiKey);
$response = $client->pluginLicenses->get();
$pluginLicenses = $response->getBody()->getContents();
$results = json_decode($pluginLicenses);
$response = $client->pluginLicenses->get([
'page' => 2
]);
$pluginLicenses = $response->getBody()->getContents();
$results = json_decode($pluginLicenses);
<?php
$response = $client->pluginLicenses->get([
'key' => 'P8GQRVQO5MK9Q673U0IJZ2I3'
]);
$pluginLicense = $response->getBody()->getContents();
$result = json_decode($pluginLicense)
$response = $client->pluginLicenses->create([
'edition' => 'standard',
'plugin' => 'sprout-forms',
'email' => 'sprout@barrelstrengthdesign.com'
]);
$pluginLicense = $response->getBody()->getContents();
$result = json_decode($pluginLicense)