PHP code example of uzzairwebstudio / onewaysms

1. Go to this page and download the library: Download uzzairwebstudio/onewaysms 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/ */

    

uzzairwebstudio / onewaysms example snippets


use Uzzairwebstudio\Onewaysms\OneWaySMSManager;

$sms = new OneWaySMSManager(
    'API_USERNAME',
    'API_PASSWORD',
    'MT_URL',
    'CHECK_STATUS_URL',
    'CHECK_CREDIT_URL'
);

// Send SMS (MobileNo, Message, SenderID = 'INFO', LanguageType = 1)
$response = $sms->send('60121234567', 'Test message');

// Check transaction status
$status = $sms->checkStatus('MT_ID_HERE');

// Check credit balance
$credit = $sms->checkCredit();

use Uzzairwebstudio\Onewaysms\OneWaySMSManager;

public function register(): void
{
    $this->app->singleton(OneWaySMSManager::class, function ($app) {
        return new OneWaySMSManager(
            env('ONEWAYSMS_API_USERNAME'),
            env('ONEWAYSMS_API_PASSWORD'),
            env('ONEWAYSMS_MT_URL'),
            env('ONEWAYSMS_CHECK_STATUS_URL'),
            env('ONEWAYSMS_CHECK_CREDIT_URL')
        );
    });
}

use Uzzairwebstudio\Onewaysms\OneWaySMSManager;

public function __invoke(OneWaySMSManager $sms)
{
    return $sms->send('60121234567', 'Hello from Laravel');
}