nogrod/dhl-shipping-php-sdk

注意:这是DPDHL集团包裹德国邮政和包裹配送API的规范。此REST Web服务允许企业客户按需创建配送标签。

v0.1.0 2024-02-19 13:32 UTC

This package is auto-updated.

Last update: 2024-09-19 15:32:42 UTC


README

注意:这是DPDHL集团包裹德国邮政和包裹配送API的规范。此REST Web服务允许企业客户按需创建配送标签。

安装和用法

要求

PHP 8.1及以后版本。

Composer

要通过Composer安装绑定,请在composer.json中添加以下内容:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/nogrod/dhl-shipping-php-sdk.git"
    }
  ],
  "require": {
    "nogrod/dhl-shipping-php-sdk": "*@dev"
  }
}

然后运行composer install

手动安装

下载文件并包含autoload.php

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

入门指南

请遵循安装过程,然后运行以下命令:

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




$apiInstance = new Dhl\Rest\Shipping\Api\GeneralApi(
    // 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()
);

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

API端点

所有URI均相对于https://api-eu.dhl.com/parcel/de/shipping/v2

模型

授权

BasicAuth

  • 类型:HTTP基本认证

ApiKey

  • 类型:API密钥
  • API密钥参数名:dhl-api-key
  • 位置:HTTP头

测试

要运行测试,请使用

composer install
vendor/bin/phpunit

作者

关于此包

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

  • API版本:2.1.8
  • 构建包:org.openapitools.codegen.languages.PhpNextgenClientCodegen