PHP code example of omakei / laravel-nextsms

1. Go to this page and download the library: Download omakei/laravel-nextsms library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

omakei / laravel-nextsms example snippets


return [
    'username' => env('NEXTSMS_USERNAME', 'NEXTSMS'),
    'password' => env('NEXTSMS_PASSWORD', 'NEXTSMS'),
    'api_key' => base64_encode(env('NEXTSMS_USERNAME', 'NEXTSMS').':'.env('NEXTSMS_PASSWORD', 'NEXTSMS')),
    'sender_id' => env('NEXTSMS_SENDER_ID', 'NEXTSMS'),
    'url' => [
        'sms' => [
            'single' => NextSMS::NEXTSMS_BASE_URL.'/api/sms/v1/text/single',
            'multiple' => NextSMS::NEXTSMS_BASE_URL.'/api/sms/v1/text/multi',
            'reports' => NextSMS::NEXTSMS_BASE_URL.'/api/sms/v1/reports',
            'logs' => NextSMS::NEXTSMS_BASE_URL.'/api/sms/v1/logs',
            'balance' => NextSMS::NEXTSMS_BASE_URL.'/api/sms/v1/balance',
        ],
        'sub_customer' => [
            'create' => NextSMS::NEXTSMS_BASE_URL.'/api/reseller/v1/sub_customer/create',
            'recharge' => NextSMS::NEXTSMS_BASE_URL.'/api/reseller/v1/sub_customer/recharge',
            'deduct' => NextSMS::NEXTSMS_BASE_URL.'/api/reseller/v1/sub_customer/deduct',
        ]
    ],
];


use Omakei\NextSMS\NextSMS;

$response = NextSMS::sendSingleSMS(['to' => '255625933171', 'text' => 'Dj Omakei is texting.']);



use Omakei\NextSMS\NextSMS;

$response = NextSMS::sendSingleSMSToMultipleDestination([
            'to' => ['255625933171','255656699895'], 
            'text' => 'Dj Omakei is texting.']);



use Omakei\NextSMS\NextSMS;

$response = NextSMS::sendMultipleSMSToMultipleDestinations(['messages' => [
                ['to' => '255625933171', 'text' => 'Dj Omakei is texting.'],
                ['to' => '255656699895', 'text' => 'Dj Omakei is texting.']
            ]]);



use Omakei\NextSMS\NextSMS;

$response = NextSMS::sendMultipleSMSToMultipleDestinations(['messages' => [
                ['to' => ['255625933171','255656699895'], 'text' => 'Dj Omakei is texting.'],
                ['to' => '255625933171', 'text' => 'Dj Omakei is texting.']
            ]]);



use Omakei\NextSMS\NextSMS;

$response = NextSMS::scheduleSMS([
            'to' => '255625933171', 
            'text' => 'Dj Omakei is texting.', 
            'date' => '2022-01-25' , 
            'time' => '12:00']);



use Omakei\NextSMS\NextSMS;

$response = NextSMS::getAllDeliveryReports();



use Omakei\NextSMS\NextSMS;

$response = NextSMS::getDeliveryReportWithMessageId(243452542526627);



use Omakei\NextSMS\NextSMS;

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



use Omakei\NextSMS\NextSMS;

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



use Omakei\NextSMS\NextSMS;

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



use Omakei\NextSMS\NextSMS;

$response = NextSMS::subCustomerCreate(
            'Michael', 
            'Omakei',
            'omakei',
            '[email protected]',
            '06259313171', 
            'Sub Customer (Reseller)', 
            100);



use Omakei\NextSMS\NextSMS;

$response = NextSMS::subCustomerRecharge('[email protected]', 100);



use Omakei\NextSMS\NextSMS;

$response = NextSMS::subCustomerDeduct('[email protected]', 100);



use Omakei\NextSMS\NextSMS;

$response = NextSMS::getSMSBalance();

bash
php artisan vendor:publish --tag="nextsms-config"