Wallogit.com
2017 © Pedro Peláez
Load4wrd is a tool for E-Loading Business for 3 networks in the Philippines.
Load4wrd is a tool for E-Loading Business for 3 networks (SMART, SUN, and GLOBE) in the Philippines., (*1)
Load4wrd is a framework agnostic PHP library that is designed to simplify the task of developing e-loading business for 3 networks (SMART, SUN, and GLOBE) in the Philippines., (*2)
The first step is using composer to install the package and automatically update your composer.json file, you can do this by running:, (*3)
composer require pollycodes/load4wrd
You need to update your application configuration in order to register the package so it can be loaded by Laravel, just update your config/app.php file adding the following code at the end of your 'providers' section:, (*4)
config/app.php, (*5)
// file START ommited
'providers' => [
// other providers ommited
PollyCodes\Load4wrd\Load4wrdServiceProvider::class,
],
// file END ommited
Go to /bootstrap/app.php file and add this line:, (*6)
// file START ommited
$app->register(PollyCodes\Load4wrd\Load4wrdServiceProvider::class);
// file END ommited
Facades are not supported in Lumen., (*7)
In order to use the Load4wrd facade, you need to register it on the config/app.php file, you can do that the following way:, (*8)
// file START ommited
'aliases' => [
'Load4wrd' => PollyCodes\Load4wrd\Facades\Load4wrd::class,
],
// file END ommited
In order to use the Load4wrd, you need to setup your account from Load4wrd on the config/services.php file, you can do that the following way:, (*9)
config/services.php, (*10)
// 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
For security purpose you can use .env file, you can do that the following way:, (*11)
.env, (*12)
// file START ommited
L4D_USERNAME=Your-Username
L4D_PASSWORD=Your-Password
L4D_ENV=false // false = sandbox, true production
// file END ommited
Sample Code:, (*13)
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;
}
}
For registration and to have a Wallet Load from Telco, (*14)
If you discover a security vulnerability within Load4wrd, please send an e-mail to King Paulo Aquino at kingpauloaquino@gmail.com. All security vulnerabilities will be promptly addressed., (*15)
Load4wrd is free software distributed under the terms of the MIT license., (*16)