PHP code example of kazinokib / bdappsapi

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

    

kazinokib / bdappsapi example snippets


use Kazinokib\BdappsApi\BdappsApi;

public function sendSms(BdappsApi $bdappsApi)
{
    $result = $bdappsApi->smsService->send('Your message', ['tel:8801812345678']);
    // Handle the result
}

use Kazinokib\BdappsApi\BdappsApi;

public function receiveSms(BdappsApi $bdappsApi)
{
    $result = $bdappsApi->smsService->receiveSms();
    // Handle the result
}

use Kazinokib\BdappsApi\BdappsApi;

public function sendUssd(BdappsApi $bdappsApi)
{
    $result = $bdappsApi->ussdService->send('Your message', 'session_id', 'tel:8801812345678');
    // Handle the result
}

use Kazinokib\BdappsApi\BdappsApi;

public function requestOtp(BdappsApi $bdappsApi)
{
    $result = $bdappsApi->otpService->requestOtp('tel:8801812345678');
    // Handle the result
}

use Kazinokib\BdappsApi\BdappsApi;

public function verifyOtp(BdappsApi $bdappsApi)
{
    $result = $bdappsApi->otpService->verifyOtp('reference_no', 'otp_code');
    // Handle the result
}

use Kazinokib\BdappsApi\BdappsApi;

public function queryBalance(BdappsApi $bdappsApi)
{
    $result = $bdappsApi->caasService->queryBalance('tel:8801812345678');
    // Handle the result
}

use Kazinokib\BdappsApi\BdappsApi;

public function directDebit(BdappsApi $bdappsApi)
{
    $result = $bdappsApi->caasService->directDebit('external_tx_id', 'tel:8801812345678', 10.00);
    // Handle the result
}

use Kazinokib\BdappsApi\Exceptions\BdappsApiException;

try {
    $result = $bdappsApi->smsService->send('Your message', ['tel:8801812345678']);
} catch (BdappsApiException $e) {
    // Handle the exception
    $errorCode = $e->getErrorCode();
    $errorDetail = $e->getErrorDetail();
}
bash
php artisan vendor:publish --provider="Kazinokib\BdappsApi\BdappsApiServiceProvider" --tag="config"