1. Go to this page and download the library: Download skriptfabrik/php-api-client 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/ */
declare(strict_types=1);
$config = Skriptfabrik\ApiClient\Configuration::getDefaultConfiguration();
$config->setDebug(true);
$api = new Skriptfabrik\ApiClient\Api\AdminApi(
// If you want to use a custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
try {
$result = $api->getAdminEntryPoint();
print_r($result);
} catch (Exception $e) {
echo 'Exception on fetching admin entry point: ', $e->getMessage(), PHP_EOL;
}
declare(strict_types=1);
ed Skriptfabrik\ApiClient\Api\AuthorizationApi $api;
public function __construct(Skriptfabrik\ApiClient\Api\AuthorizationApi $api)
{
$this->api = $api;
}
/**
* @throws Skriptfabrik\ApiClient\ApiException
*/
public function createAccessToken(string $username, string $password): string
{
$request = new Skriptfabrik\ApiClient\Model\CreateAccessTokenRequest([
'username' => $username,
'password' => $password,
]);
return $this->api->createAccessToken($request)->getToken();
}
}