Skip to content

ngarak-dev/nextsms

Repository files navigation

NextSMS

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages