elmage/textng-php

An unofficial textng.xyz SMS API Wrapper for PHP

v0.2.0 2020-08-20 01:56 UTC

This package is auto-updated.

Last update: 2024-04-20 10:31:22 UTC


README

Latest Version on Packagist Latest Version on Packagist Software License Build Status Coverage Status

This is an unofficial client library for the TextNg SMS API. We provide an intuitive, stable interface to integrate TextNG SMS into your PHP project.

Installation

Install the library using Composer. Please read the Composer Documentation if you are unfamiliar with Composer or dependency managers in general.

$ composer require elmage/textng-php

Authentication

API Key

use Elmage\TextNg\Configuration;
use Elmage\TextNg\Client;

$configuration = new Configuration($apiKey, $senderName);
$client = Client::create($configuration);

Usage

This is not intended to provide complete documentation of the API. For more detail, please refer to the Official Documentation.

Get Unit Balance

$response = $client->getBalance();

Send SMS

$response = $client->sendSMS($route, $phoneNumbers, $message, $bypassCode, $optionalParamsArray);

Send OTP

// This method accepts only one phone number 
// and calls $client->sendSMS(..., [$phoneNumber], ...)
// passing the supplied phone number as the single element in an array

$response = $client->sendOTP($route, $phoneNumber, $message, $bypassCode, $optionalParamsArray);

Get Delivery Report

$response = $client->getDeliveryReport($reference, $req, $used_route);

$req can take one of the 3 values all, dnd or success (as specified in the API DOC)

Create Customer

$response = $client->createCustomer($customerName, $customerPhone, $categoryID);

$categoryID is the category url ID generated for each url link you create. (as specified in the API DOC)

Remove Customer

$response = $client->removeCustomer($customerPhone, $categoryID);

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email mails4mage@gmail.com or use the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.