usmsgh/usmsgh-v3-api-sdk

PHP SDK for the Urhitech Bulk SMS V3 API

v1.1.1 2023-11-29 14:46 UTC

This package is auto-updated.

Last update: 2024-09-29 16:34:51 UTC


README

The Urhitech SMS PHP SDK provides a suitable approach to the USMSGH API from applications written in PHP. It includes pre-defined set of classes and functions for API resource that initialize themeselves from API responses.

The library provides other features. For Example:

  1. Easy configuration path for fast setup and use
  2. Helpers for pagination.

You can sign up for a USMSGH account at usmsgh.com

Prerequisites

PHP ^8.0 and later

Installation

Via Composer

$ composer require usmsgh/usmsgh-v3-api-sdk

Via Git Bash

git clone https://github.com/majesty2017/usmsgh-v3-api-sdk.git

Documentation

Please see https://usmsgh.com/developer/ for up-to-date documentation

Usage

Step 1:

If you install the Urhitech SMS PHP SDK via Git Clone then load the Urhitech SMS PHP API class file and use namespace.

require_once '/path/to/src/Usms.php';
use Urhitech\Usms;

If you install Urhitech SMS PHP SDK via Composer the Require the autoload.php file in the index.php of your project or whatever file you need to use Urhitech SMS PHP API classes.

require __DIR__ . '/vendor/autoload.php';
use use Urhitech\Usms;

The Urhitech SMS PHP SDK endpoints are RESTful, and consume and return JSON. All Http endpoints requires an API Key in the request header.

For more information on how to get an API Key visit here to copy or generate new key for authorization.

HTTP ENDPOINTS

Step 2:

Instantiate the UrhitechSMSPHPAPI

$client = new Urhitech\Usms;

Send SMS

$api_key = "Enter Your API Key here";

$url = "https://webapp.usmsgh.com/api/v3/sms/send";

$recipients = "233500000000,233540000000";
$message = "Hello world";
$senderid = "Enter your approved sender ID here";

$response = $client->send_sms($url, $api_key, $senderid, $recipients, $message);

Check SMS Credit Balance

$api_key = "Enter Your API Key here";

$url = "https://webapp.usmsgh.com/api/v3/balance";

$get_credit_balance = $client->check_balance($url, $api_key);

View Profile

$api_key = "Enter Your API Key here";

$url = "https://webapp.usmsgh.com/api/v3/me";

$get_profile = $client->profile($url, $api_key);

Status Code