PHP SDK

Install

The Uni PHP SDK is hosted by Packagist and is available from the public Packagist repository.

Use Composer to add apistd/uni-sdk as a dependency in the project:

composer require apistd/uni-sdk

Usage

The following example shows how to use the Uni PHP SDK to quickly invoke a service.

Send an SMS


use Uni\Common\UniException;
use Uni\SMS\UniSMS;

// initialization
$client = new UniSMS([
  'accessKeyId' => 'your access key id',
  'accessKeySecret' => 'your access key secret', // if you use the simple auth mode, just delete this line
  'endpoint' => 'https://api.unimtx.com' // set endpoint
]);

// send the message
try {
  $resp = $client->send([
    'to' => 'your phone number',
    'signature' => 'Unimatrix',
    'templateId' => 'pub_verif_basic',
    'templateData' => [
      'code' => 7777
    ]
  ]);
  var_dump($resp->data);
} catch (UniException $e) {
  print_r($e);
}