cayeye/api-client

This package has no released version yet, and little information is available.


README

Cayeye WA Api

Install

Via Composer

$ composer require cayeye/api-client

Usage

use Cayeye\WA\Api\ApiClient;
use Cayeye\WA\Exception\UnauthorizedException;
use Doctrine\Common\Annotations\AnnotationRegistry;

include_once('vendor/autoload.php');

AnnotationRegistry::registerLoader('class_exists');

$apiClient = new ApiClient('https://api.cayeye.io', /* enter api key here */ '...');

try {
    $id = $apiClient->sendChat(/* gateway */ '49123456789', /* recipient */ '49123456789', 'Hello World');
    echo "Sent message with id " . $id;

} catch (UnauthorizedException $e) {
    echo "the provided api key was invalid";

} catch (\Exception $e) {
    echo "error occured";
}

Examples

Please look into the examples folder for more examples.

Mock Testing

You can use the ApiClientMock class to mock test your code using this library.