定制 apiship/apidq-client-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

apiship/apidq-client-php

最新稳定版本:v3.0.0

Composer 安装命令:

composer require apiship/apidq-client-php

包简介

PHP client for ApiDQ API

README 文档

README

ApiDQ API PHP Client

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require codecov

This is the PHP ApiDQ API client. This library allows using of the actual API version. You can find more info in the documentation.

Installation

Follow those steps to install the library:

  1. Download and install Composer package manager.
  2. Install the library from the Packagist by executing this command:
composer require apiship/apidq-client-php:"~3.0"

Note: API client uses php-http/client-implementation as a PSR-18, PSR-17 implementation. You can replace those implementations during installation by installing this library with the implementation of your choice, like this:

composer require symfony/http-client guzzlehttp/psr7 apiship/apidq-client-php:"~3.0"

Usage

Firstly, you should initialize the Client. The easiest way to do this is to use the SimpleClientFactory:

$client = \ApiDQ\Factory\SimpleClientFactory::createClient('https://api.apidq.io', 'apiKey');
$client = \ApiDQ\Factory\SimpleClientFactory::createClientWithCache('https://api.apidq.io', 'apiKey', $psrCache);
$client = \ApiDQ\Factory\SimpleClientFactory::createClientWithFileCache('https://api.apidq.io', 'apiKey', sys_get_temp_dir());

The client is separated into several resource groups, all of which are accessible through the Client's public properties. You can call API methods from those groups like this:

$cleanResponse = $client->address->clean(
    (new \ApiDQ\Model\Service\Address\CleanRequest())
        ->setQuery('Москва')
        ->setCountryCode('RU')
);

To handle errors you must use two types of exceptions:

  • ApiDQ\Exception\Service\ServiceException for the api service error.
  • ApiDQ\Exception\Client\BuilderException for the client builder error.

统计信息

  • 总下载量: 3.93k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-20