unimtx/uni-sdk

The official Unimatrix SDK for PHP.

v0.2.0 2022-12-16 17:29 UTC

This package is auto-updated.

Last update: 2023-03-20 10:18:37 UTC


README

Packagist Release GitHub license

The Unimatrix PHP SDK provides convenient access to integrate communication capabilities into your PHP applications using the Unimatrix HTTP API. The SDK provides support for sending SMS, 2FA verification, and phone number lookup.

Getting started

Before you begin, you need an Unimatrix account. If you don't have one yet, you can sign up for an Unimatrix account and get free credits to get you started.

Documentation

Check out the documentation at unimtx.com/docs for a quick overview.

Installation

Using Composer is the recommended way to install the Unimatrix SDK for PHP, which is available on Packagist.

Run the following command to add unimtx/uni-sdk as a dependency to your project:

composer require unimtx/uni-sdk

Usage

The following example shows how to use the Unimatrix PHP SDK to interact with Unimatrix services.

Send SMS

Send a text message to a single recipient.

use Uni\UniClient;
use Uni\UniException;

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

try {
  $resp = $client->messages->send([
    'to' => 'your phone number', // in E.164 format
    'signature' => 'your sender name',
    'content' => 'Your verification code is 2048.'
  ]);
  var_dump($resp->data);
} catch (UniException $e) {
  print_r($e);
}

Reference

Other Unimatrix SDKs

To find Unimatrix SDKs in other programming languages, check out the list below:

License

This library is released under the MIT License.