Skip to content

webservices-nl/platform-connector

Repository files navigation

Webservices Platform Connector

External checks

Scrutinizer Code Quality Code Coverage Build Status

This factory abstracts protocol specific's implementations for connecting to the Webservices.nl API. Providing an unified service layer independent of protocol.

The purpose of this library is to connect to any of the Webservices.nl API's (platforms) in a uniform way. Regardless of transport protocol it ships a proxy class for type hinted function calls to Webservices.nl function calls.

Supported protocols

Webservices.nl support multiple protocols for connecting. Soap, XML-RPC, HTTP-RPC/REST. This library has support for multiple transfer protocols.

Soap

This library ships a SoapClient that extends the native PHP SoapClient with a curl client for better timeout management. Also converts native PHP SoapFault into custom platform exceptions where possible.

XML-RPC

Scheduled to be released.

REST

Scheduled to be released.

Pre-requisites

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

Install

Please use composer to install this library. Or download the latest zip

composer require webservices-nl/platform-connector

Usage

 
 // 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();

All parameters are expected to be in UTF-8 encoding, output is in UTF-8 as well.

Unit test

This client is fully tested on PHP 5.6+ and 7+ To run tests:

./vendor/bin phpunit

Further information

Consult the online documentation. Any questions, remarks, bugs? Please mail us.