zato/api-client

PHP API client for Zato services

This package's canonical repository appears to be gone and the package has been frozen as a result.

v2.0.0 2016-06-28 18:16 UTC

This package is not auto-updated.

Last update: 2022-02-09 07:13:12 UTC


README

This client offers developers an easy way to invoke Zato services

To get started, install composer in your project:

$ curl -s https://getcomposer.org/installer | php

Next, add a composer.json file containing the following:

}
    "require": {
        "zato/api-client": "dev-master"
    }
}

Alternatively you can use composer require in your project

/opt/local/bin/composer/composer require zato/api-client

Then, install!

$ php composer.phar install

Usage

Using the Zato PHP API client is easy:

First, create a new set of HTTP Basic Auth credentials (username: php.client) (https://zato.io/docs/web-admin/security/basic-auth.html)

Then use the client as follows:

<?php

require 'vendor/autoload.php';

use zato\ZatoClient;

$config = array(
    'user' => 'pubapi',
    'pass' => 'yourpassword',
    'hostname' => 'your_zato_host',
    'port' => '11223');

$client = new ZatoClient($config);

// What are you sending to the zato service you are about to invoke
$payload = array('customers' => array(
	'name' => 'jon oliver',
	'name' => 'monica geller',
	'name' => 'nelson bigetti'));

// params are the same as the zato service, 
// only difference is that we do automatic enconde/decode of your objects
$params = array('name' => 'my-awesome-service', 
				'payload' => $payload

// Result from zato is returned as object
$serviceResult = $client->serviceInvoke($params);
var_dump($serviceResult);