ngarak-dev/nextsms

There is no license information available for the latest version (v1.0.1) of this package.

A Laravel package to send SMS using NextSMS API. Basically a folk from https://github.com/omakei with updated packages support for laravel 10 and 11

v1.0.1 2024-04-11 14:19 UTC

This package is auto-updated.

Last update: 2024-05-11 14:41:40 UTC


README

A Laravel package to send SMS using NextSMS API. Basically a folk from https://github.com/omakei with updated packages support for laravel 10 and 11

Installation

You can install the package via composer:

composer require ngarak-dev/nextsms

The following keys must be available in your .env file:

NEXTSMS_USERNAME=
NEXTSMS_PASSWORD=
NEXTSMS_SENDER_ID=

Usage

Send SMS

NB: Telephone Number Must Start with Valid Country Code. Example: 255768491010

Sending single sms to single destination:

use NgarakDev\NextSMS\NextSMS;

$response = NextSMS::sendSingleSMS(['to' => '25500000000', 'text' => 'Hellooooo Next.']);

Sending single sms to multiple destinations:

use NgarakDev\NextSMS\NextSMS;

$response = NextSMS::sendSingleSMSToMultipleDestination([
            'to' => ['255000000000','255111111111'], 
            'text' => 'Helooooo.']);

Sending multiple sms to multiple destinations (Example 1):

use NgarakDev\NextSMS\NextSMS;

$response = NextSMS::sendMultipleSMSToMultipleDestinations(['messages' => [
                ['to' => '255000000000', 'text' => 'Helooo Next.'],
                ['to' => '255111111111', 'text' => 'Helooo Next.']
            ]]);

Sending multiple sms to multiple destinations (Example 2):

use NgarakDev\NextSMS\NextSMS;

$response = NextSMS::sendMultipleSMSToMultipleDestinations(['messages' => [
                ['to' => ['25500000000','25500000000'], 'text' => 'Heloooooooo.'],
                ['to' => '25500000000', 'text' => 'Heloooooooo.']
            ]]);

Schedule sms:

use NgarakDev\NextSMS\NextSMS;

$response = NextSMS::scheduleSMS([
            'to' => '25500000000', 
            'text' => 'Heloooooooo.', 
            'date' => '2022-01-25' , 
            'time' => '12:00']);

SMS Delivery Reports

Get all delivery reports:

use NgarakDev\NextSMS\NextSMS;

$response = NextSMS::getAllDeliveryReports();

Get delivery reports with messageId:

use NgarakDev\NextSMS\NextSMS;

$response = NextSMS::getDeliveryReportWithMessageId(243452542526627);

Get delivery reports with messageId:

use NgarakDev\NextSMS\NextSMS;

$response = NextSMS::getDeliveryReportWithSpecificDateRange('2022-01-25', '2022-01-29');

Sent Sms Logs

Get all sent SMS logs:

use NgarakDev\NextSMS\NextSMS;

$response = NextSMS::getAllSentSMSLogs(10, 5);

Get all sent SMS logs with the optional parameter:

use NgarakDev\NextSMS\NextSMS;

$response = NextSMS::getAllSentSMSLogsWithOptionalParameter('255000000000','2022-01-25', '2022-01-29',10, 5);

Sub Customer

Register Sub Customer:

use NgarakDev\NextSMS\NextSMS;

$response = NextSMS::subCustomerCreate(
            'Michael', 
            'Juma',
            'test@gmail.com',
            '062500000000', 
            'Sub Customer (Reseller)', 
            100);

Recharge customer:

use NgarakDev\NextSMS\NextSMS;

$response = NextSMS::subCustomerRecharge('otest@gmail.com', 100);

Deduct a customer:

use NgarakDev\NextSMS\NextSMS;

$response = NextSMS::subCustomerDeduct('test@gmail.com', 100);

Get sms balance:

use NgarakDev\NextSMS\NextSMS;

$response = NextSMS::getSMSBalance();

NextSMS API Documentation

Please see NextSMS Developer API for more details.

Testing

composer test