Skip to content

Latest commit

 

History

History
51 lines (36 loc) · 1.63 KB

File metadata and controls

51 lines (36 loc) · 1.63 KB

Cloud Factory API

PHP wrapper for the Cloud Factory API

Requirements

PHP Version Require

Status

workflow Latest Stable Version Latest Unstable Version License

Cloud Factory Docs

Installation

composer require inserve/cloud-factory-api-php

Usage example

use GuzzleHttp\Client;
use Inserve\CloudFactoryAPI\CloudFactoryAPIClient;

require 'vendor/autoload.php';

$guzzle = new Client([
    'base_uri' => 'https://portal.api.cloudfactory.dk',
]);

$cloudFactory = new CloudFactoryAPIClient(
    client: $guzzle,
);

$accessToken = $api->exchangeRefreshToken('refresh.token');
$cloudFactory->setAccessToken($accessToken);

if (! $cloudFactory->isAuthenticated()) {
    return;
}

$customerList = $cloudFactory->getCustomers([
    'PageSize' => 100
]);

foreach ($customerList->getResults() as $customer) {
    echo $customer->getName() . PHP_EOL;
}