planviewer/api-client-php

访问 Planviewer API 的客户端库

1.0.4 2020-08-25 06:07 UTC

README

Composer 安装

到目前为止,安装 api-client 最简单的方法是使用 Composer 进行要求。

$ composer require "planviewer/api-client-php:^1.0.0"

{
    "require": {
        "planviewer/api-client-php": "^1.0.0"
    }
}

手动安装

如果您不熟悉使用 composer,我们已在发布中添加了一个包含 API 客户端的 ZIP 文件。从 发布页面 下载 api-client-php。

基本身份验证

为了使用 Planviewer API,您需要客户端和密钥。请登录到 https://www.planviewer.nl 并转到您的应用: https://www.planviewer.nl/my_api/applications/

生成随机的客户端和密钥。

将客户端和密钥添加到 /config/config.php 或您的配置文件中。

return [
    'api-key' => '86c****7b',
    'api-secret' => '3783******6b3ab4c87fef3ffc*****bb058a72c****cbef2d',
];

类集成

在您的类或脚本中添加 use,创建 Planviewer 对象的实例。

use Planviewer/Planviewer;

$planviewer = new Planviewer($config);

Planviewer 对象包含我们所有的 API。您可以按照以下方式访问调用

/** Access Maps API  */
$planviewer->mapsApi>listViewers();

/** Access Data API  */
$planviewer->dataApi->getdataList();

/** Access Product API  */
$planviewer->productApi->getProducts();