pfm_webservices_nl/platform-connector

为 Webservices.nl 提供的 platform connector 生成器

0.0.6 2023-08-14 08:12 UTC

This package is auto-updated.

Last update: 2024-09-14 10:15:37 UTC


README

外部检查

Scrutinizer Code Quality Code Coverage Build Status

此工厂抽象了特定协议的实现,用于连接到 Webservices.nl API,提供独立于协议的统一服务层。

此库的目的是以统一的方式连接到任何 Webservices.nl API(平台)。无论传输协议如何,它都提供了一个代理类,用于类型提示函数调用到 Webservices.nl 函数调用。

支持的协议

Webservices.nl 支持多种连接协议。Soap、XML-RPC、HTTP-RPC/REST。此库支持多种传输协议。

Soap

此库包含一个 SoapClient,它扩展了原生 PHP SoapClient,使用 curl 客户端进行更好的超时管理。在可能的情况下,还将原生 PHP SoapFault 转换为自定义平台异常。

XML-RPC

计划发布。

REST

计划发布。

先决条件

  • PHP 5.6<=
  • composer
  • PSR-log LoggerInterface(可选)

安装

请使用 composer 安装此库。或者下载最新的 zip

composer require webservices-nl/platform-connector

用法

 
 // Instantiate a ConnectorFactory with your given Webservices.nl credentials.
 $factory = ConnectorFactory::build(
  [
    'username' => 'myusername',
    'password' => 'secret'
  ],
  LoggerInterface (optional)
 );
 
 // build a client
 $client = $factory->create('soap', 'webservices');
 
 // make type hinted function calls to any of the Webservices.nl API's
 $response = $client->accountEditV2();

所有参数预期都使用 UTF-8 编码,输出也使用 UTF-8 编码。

单元测试

此客户端已在 PHP 5.6+ 和 7+ 上完全测试。要运行测试

./vendor/bin phpunit

更多信息

请查阅在线 文档。有任何问题、意见、错误?请给我们发送邮件。