PHP code example of henryejemuta / php-vtpass-vtu

1. Go to this page and download the library: Download henryejemuta/php-vtpass-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-vtpass-vtu example snippets


use HenryEjemuta\Vtpass\Client;

// Initialize the client
// For Live Environment
$client = new Client('your-api-key', 'your-public-key', 'your-secret-key');

// For Sandbox Environment
$client = new Client('your-api-key', 'your-public-key', 'your-secret-key', [
    'sandbox' => true
]);

// Get Service Categories
$categories = $client->getServiceCategories();

// Purchase Airtime
$response = $client->purchaseAirtime('mtn', 100, '08012345678');

// Purchase Data
$response = $client->purchaseData('mtn-data', '08012345678', 'sme-month-1GB', 300);
bash
composer