PHP code example of barrelstrength / craftnet-php

1. Go to this page and download the library: Download barrelstrength/craftnet-php 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/ */

    

barrelstrength / craftnet-php example snippets

 php
{
    "arrelstrength/craftnet-php": "{version}"
    }
}
 php
 php
use barrelstrength\craftnetphp\CraftnetClient;

$username = 'USERNAME';
$apiKey = 'API_KEY;

$client = new CraftnetClient($username, $apiKey);
 php
$response = $client->pluginLicenses->get();

$pluginLicenses = $response->getBody()->getContents();

$results = json_decode($pluginLicenses);
 php
$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)
 php
$response = $client->pluginLicenses->create([
  'edition' => 'standard',
  'plugin' => 'sprout-forms',
  'email' => '[email protected]'
]);

$pluginLicense = $response->getBody()->getContents();

$result = json_decode($pluginLicense)