savvii/openprovider-rest

PHP client for the Openprovider REST API

1.0.1 2023-02-09 01:54 UTC

This package is auto-updated.

Last update: 2024-12-06 16:41:15 UTC


README

Inspired by Openprovider's version which is unfortunately outdated at the moment of writing.

The code in this package is generated by the OpenAPI Generator project

Installation & Usage

Requirements

PHP 7.4 and later

Composer

Run composer require savvii/openprovider-rest

Getting Started

Example for PHP 8.0 or newer because it really helps to be able to use Named Arguments.

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$config = \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);
}

API Endpoints

All URIs are relative to https://api.openprovider.eu

Models

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0-beta
    • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen