PHPackages                             barrelstrength/craftnet-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. barrelstrength/craftnet-php

ActiveLibrary[API Development](/categories/api)

barrelstrength/craftnet-php
===========================

A PHP library which implements the functionality of the Craftnet API

1.0.0(7y ago)87572[1 issues](https://github.com/barrelstrength/craftnet-php/issues)1MITPHP

Since Apr 21Pushed 2y ago1 watchersCompare

[ Source](https://github.com/barrelstrength/craftnet-php)[ Packagist](https://packagist.org/packages/barrelstrength/craftnet-php)[ RSS](/packages/barrelstrength-craftnet-php/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (4)Used By (1)

Craftnet API PHP Wrapper
========================

[](#craftnet-api-php-wrapper)

A PHP library which implements the functionality of the Craftnet API. See the Craftnet API [documentation](https://docs.api.craftcms.com) for all available settings.

Installation
------------

[](#installation)

Add the library to your project via composer:

```
{
    "require": {
        "barrelstrength/craftnet-php": "{version}"
    }
}
```

Require the library in your project:

```
require __DIR__ . '/vendor/autoload.php';
```

Authentication
--------------

[](#authentication)

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);
```

Get all plugin licenses for the authenticated Craft ID user
-----------------------------------------------------------

[](#get-all-plugin-licenses-for-the-authenticated-craft-id-user)

```
$response = $client->pluginLicenses->get();

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

$results = json_decode($pluginLicenses);
```

Get a secondary page of plugin licenses for the authenticated Craft ID user
---------------------------------------------------------------------------

[](#get-a-secondary-page-of-plugin-licenses-for-the-authenticated-craft-id-user)

```
$response = $client->pluginLicenses->get([
  'page' => 2
]);

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

$results = json_decode($pluginLicenses);
```

Get a specific plugin license for the authenticated Craft ID user
-----------------------------------------------------------------

[](#get-a-specific-plugin-license-for-the-authenticated-craft-id-user)

```
