taliffsss/unisms

PHP client library for the UniSMS API (https://unismsapi.com)

Maintainers

Package info

github.com/taliffsss/unisms

Homepage

pkg:composer/taliffsss/unisms

Transparency log

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-07-02 16:18 UTC

This package is auto-updated.

Last update: 2026-07-04 10:02:39 UTC


README

Community PHP SDK for the UniSMS API — a powerful, reliable, and developer-friendly SMS API for the Philippines, supporting all major carriers (Globe, Smart, DITO, Sun, TNT).

This is a community-maintained library for the UniSMS API, created to simplify integration for PHP developers. It provides a clean, intuitive interface for sending SMS messages and checking delivery status.

Requirements

  • PHP 8.0 or higher
  • ext-curl
  • ext-json

Installation

composer require taliffsss/unisms

Usage

Sending an SMS

use Taliffsss\UniSms\UniSms;

$uniSms = new UniSms('your-secret-key');

$response = $uniSms->to('+639171234567')
    ->message('Hello world')
    ->from('MyBrand') // optional, defaults to "UniSMS"
    ->withMetadata(['order_id' => 12345]) // optional, echoed back by the API
    ->send();

// $response['message']['reference_id'], $response['message']['status'], ...

Checking a message's status

$status = $uniSms->get('msg_84e8b93b-6315-46af-a686');

Error handling

use Taliffsss\UniSms\Exceptions\ApiException;
use Taliffsss\UniSms\Exceptions\TransportException;
use Taliffsss\UniSms\Exceptions\UniSmsException;

try {
    $uniSms->to('639171234567')->message('Hello world')->send();
} catch (ApiException $e) {
    // The API reached but returned a non-2xx response.
    $e->getStatusCode();
    $e->getResponseBody();
} catch (TransportException $e) {
    // The request could not be completed (network/timeout/etc.).
} catch (UniSmsException $e) {
    // Any other client-side validation error (e.g. missing recipient).
}

Testing

composer install
composer test

License

The MIT License (MIT). See LICENSE for details.