PHP code example of pollycodes / load4wrd

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

    

pollycodes / load4wrd example snippets


// file START ommited
    'providers' => [
        // other providers ommited
        PollyCodes\Load4wrd\Load4wrdServiceProvider::class,
    ],
// file END ommited

// file START ommited
	$app->register(PollyCodes\Load4wrd\Load4wrdServiceProvider::class);
// file END ommited

// file START ommited
    'aliases' => [
        'Load4wrd' => PollyCodes\Load4wrd\Facades\Load4wrd::class,
    ],
// file END ommited

// file START ommited
    return [
        'load4wrd' => [
            'username' => env('L4D_USERNAME', 'Your-Username'),
            'password' => env('L4D_PASSWORD', 'Your-Password'),
            'environment' => env('L4D_ENV', false), // false = sandbox, true = production
        ],
    ];
// file END ommited

// file START ommited
    L4D_USERNAME=Your-Username
    L4D_PASSWORD=Your-Password
    L4D_ENV=false // false = sandbox, true production
// file END ommited

namespace App\Http\Controllers;

use PollyCodes\Load4wrd\Loading;

class LoadController extends Controller
{
    // TARGET-MOBILE-NUMBER', 'PRODUCT-CODE', 'YOUR-16-UNIQUE-REFERENCE'
    // Example:
    // RequestLoad('09191234567', 'W5', '1234567890123456');
    public function RequestLoad($target, $code, $uniq_reference) {
      $loading = new Loading();
      $json = $loading->Send($target, $code, $uniq_reference);
      return $json;
    }

    // submit reference number return from RequestLoad
    public function VerifyLoadRequest($reference) {
      $loading = new Loading();
      $json = $loading->Verify($reference);
      return $json;
    }

    public function CheckWallet() {
      $loading = new Loading();
      $json = $loading->Balance();
      return $json;
    }

    // network = SMART, SUN, and GLOBE
    // set null for all networks product codes
    public function GetProductCodes($network = null) {
      $loading = new Loading();
      $json = $loading->Product_Codes($network);
      return $json;
    }

    public function CheckProductCode($code) {
      $loading = new Loading();
      $json = $loading->Check_Product_Code($code);
      return $json;
    }
}