cayeye/api-client

This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.

Maintainers

Details

github.com/Cayeye/php-api-client

Installs: 455

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

pkg:composer/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.