A Guzzle client for interacting with the Clickatell API

v2.0.5 2015-05-12 00:08 UTC


Build Status

A PHP 5.3+ client for interacting with the Clickatell HTTP API.


Add this to your composer.json by running composer.phar require bluedogtraining/guzzle-clickatell.


Create API client

$client = \Bdt\Clickatell\ClickatellClient::factory(array(
    'api_id'   => $apiId,
    'user'     => $user,
    'password' => $password,

Authenticate to the API


Ping the API to keep the session ID alive

$client->getCommand('Ping', array('session_id' => $sessionId))->execute();

Send a message

Passing a session_id parameter is optional. If it isn't present the client will use the authentication details provided.

$result = $client->getCommand('SendMsg', array(
    'to'   => $mobileNumber,
    'text' => $messageContents,

$result->isSuccessful();  // true
$result->getMessageIds(); // array('mobile_number' => 'message_id')

A quicker way to send a message is:

$result = $client->sendMessage($mobileNumber, $messageContents); // true|false

Query a message

$client->getCommand('QueryMsg', array(
    'apimsgid' => $messageId,

Running Tests

First, install PHPUnit with composer.phar install --dev, then run ./vendor/bin/phpunit.

More Reading