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
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=
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']);
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');
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);
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();
Please see NextSMS Developer API for more details.
composer test