PHP code example of unimtx / uni-sdk

1. Go to this page and download the library: Download unimtx/uni-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

unimtx / uni-sdk example snippets


use Uni\UniClient;

$client = new UniClient([
  'accessKeyId' => 'your access key id',
  'accessKeySecret' => 'your access key secret'
]);

use Uni\UniClient;
use Uni\UniException;

$client = new UniClient();

try {
  $resp = $client->messages->send([
    'to' => '+1206880xxxx', // in E.164 format
    'text' => 'Your verification code is 2048.'
  ]);
  var_dump($resp->data);
} catch (UniException $e) {
  print_r($e);
}

use Uni\UniClient;
use Uni\UniException;

$client = new UniClient();

$resp = $client->otp->send([
  'to' => '+1206880xxxx'
]);
var_dump($resp->data);

use Uni\UniClient;
use Uni\UniException;

$client = new UniClient();

$resp = $client->otp->verify([
  'to' => '+1206880xxxx',
  'code' => '123456' // the code user provided
]);
var_dump($resp->valid);