netzfabrik/netzfabrik-php-api

NETZFABRIK API 的 PHP SDK

dev-main 2023-06-12 08:03 UTC

This package is not auto-updated.

Last update: 2024-10-01 12:39:18 UTC


README

NETZFABRIK API 的 PHP 客户端库

有关更多信息,请访问 https://www.netzfabrik.com.

安装与使用

要求

PHP 7.4 及以上版本。也应与 PHP 8.0 兼容。

Composer

要通过 Composer 安装绑定,请将以下内容添加到 composer.json

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/NETZFABRIKCOM/netzfabrik-php-api.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

然后运行 composer install

手动安装

下载文件并包含 autoload.php

<?php
require_once('/path/to/netzfabrik-php/vendor/autoload.php');

入门

请按照安装过程进行操作,然后运行以下命令

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



// Configure API key authorization: JWT
$config = NETZFABRIK\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = NETZFABRIK\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');


$apiInstance = new NETZFABRIK\Api\AccountApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$id = 'id_example'; // string | Account identifier

try {
    $result = $apiInstance->getAccount($id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AccountApi->getAccount: ', $e->getMessage(), PHP_EOL;
}

API 端点

所有 URI 都相对于 https://

模型

授权

为API定义的认证方案

JWT

  • 类型:API密钥
  • API密钥参数名:授权
  • 位置:HTTP头部

测试

要运行测试,使用

composer install
vendor/bin/phpunit

作者

info@netzfabrik.com

关于此包

此PHP包由OpenAPI Generator项目自动生成

  • API版本:0.0.0
  • 构建包:org.openapitools.codegen.languages.PhpClientCodegen