cayeye/api-client

此包尚未发布任何版本,可用的信息不多。


README

Cayeye WA Api

安装

通过Composer

$ composer require cayeye/api-client

用法

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文件夹以获取更多示例。

模拟测试

您可以使用ApiClientMock类使用此库模拟测试您的代码。