PHP code example of henryejemuta / php-peyflex-vtu
1. Go to this page and download the library: Download henryejemuta/php-peyflex-vtu 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/ */
henryejemuta / php-peyflex-vtu example snippets
use HenryEjemuta\Peyflex\Client;
$config = [
'base_url' => 'https://client.peyflex.com.ng/api/', // Optional: Defaults to live URL
'timeout' => 30, // Optional: Request timeout in seconds
];
$client = new Client('YOUR_API_TOKEN', $config);
// Network identifier and plan code come from getDataNetworks() / getDataPlans()
$response = $client->purchaseData('mtn_data_share', '08012345678', 'M1GBS');
print_r($response);
// Verify the IUC/Smartcard first
$verify = $client->verifyCable('dstv', '1234567890');
// Then subscribe: provider, IUC, plan code, subscriber phone, amount
$response = $client->purchaseCable('dstv', '1234567890', 'premium', '08012345678', 5000);
print_r($response);
// Verify the meter first
$verify = $client->verifyMeter('ikeja-electric', '1234567890', 'prepaid');
// Then pay: disco plan, meter, amount, type, subscriber phone
$response = $client->purchaseElectricity('ikeja-electric', '1234567890', 1000, 'prepaid', '08012345678');
print_r($response);
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.