PHP code example of savvii / openprovider-rest

1. Go to this page and download the library: Download savvii/openprovider-rest 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/ */

    

savvii / openprovider-rest example snippets



fig = \Savvii\OpenproviderRest\Configuration::getDefaultConfiguration();
$config->setApiKeyPrefix('Authorization', 'Bearer');
$config->setDebug(false);

$loginResult = (new \Savvii\OpenproviderRest\Api\AuthApi())->login(
    new \Savvii\OpenproviderRest\Model\AuthLoginRequest([
        'username' => '__FILL_ME__',
        'password' => '__FILL_ME__'
    ])
);

$config->setApiKey('Authorization', $loginResult->getData()->getToken());

$domainApi = new \Savvii\OpenproviderRest\Api\DomainServiceApi(config: $config);
$listResponse = $domainApi->listDomains(full_name: 'savvii.nl', limit: 1);
$data = $listResponse->getData();
if (1 == $data->getTotal())
{
    $result = $data->getResults()[0];
    printf("ID: %d, Auth Code: %s\n\n", $result->getId(), $result->getAuthCode());
    $arrayResult = json_decode($result, true);
    var_dump($arrayResult);
}