henryejemuta / php-clubkash-vtu
A PHP package for integrating with the ClubKash VTU API.
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/henryejemuta/php-clubkash-vtu
Requires
- php: ^7.4 || ^8.0
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.92
- phpunit/phpunit: ^9.0
README
A robust PHP package for integrating with the ClubKash (Nellobytes Systems) VTU API. This package allows you to easily purchase airtime, data, cable TV, and electricity tokens.
Features
- Airtime Purchase: Buy airtime for all major Nigerian networks.
- Data Purchase: Buy data bundles for all major Nigerian networks.
- Cable TV Subscription: Subscribe to DSTV, GOTV, and Startimes.
- Electricity Bill Payment: Pay for prepaid and postpaid electricity meters.
- Wallet Balance: Check your wallet balance.
- Universal Compatibility: Works with Laravel, CodeIgniter, Symfony, and raw PHP projects.
Installation
You can install the package via composer:
composer require henryejemuta/php-clubkash-vtu
Usage
Initialization
To start using the package, initialize the Client with your UserID, API Key, and optional configuration.
You can also pass an existing token if available to skip initial authentication.
use HenryEjemuta\Clubkash\Client; $config = [ 'timeout' => 30, // 'token' => 'YOUR_CACHED_TOKEN', // Optional: Reuse valid token ]; $client = new Client('YOUR_USER_ID', 'YOUR_API_KEY', $config);
Authentication (Token Generation)
The API supports token-based authentication. Tokens are valid for 7 days. It is recommended to cache the token and reuse it.
// Authenticate to get a new token $authResponse = $client->authenticate(); if (isset($authResponse['token'])) { $token = $authResponse['token']; // Store $token in your database/cache with expiry }
Check Wallet Balance
try { $balance = $client->getWalletBalance(); print_r($balance); } catch (\Exception $e) { echo "Error: " . $e->getMessage(); }
Airtime Purchase
// Network Codes: 01=MTN, 02=GLO, 03=9Mobile, 04=Airtel $response = $client->purchaseAirtime('01', 100.00, '08012345678'); print_r($response);
Data Purchase
// Data Plan Code: Get from ClubKash Documentation or use verify tool $response = $client->purchaseData('01', 'DATA_PLAN_CODE', '08012345678'); print_r($response);
Cable TV Subscription
// CableTV: 'dstv', 'gotv', 'startimes' $response = $client->purchaseCableTV('dstv', 'package_code', 'IUC_NUMBER', 'PHONE_NUMBER'); print_r($response);
Electricity Payment
// ElectricCompany: '01', '02', etc. MeterType: '01' (Prepaid), '02' (Postpaid) $response = $client->purchaseElectricity('01', 'METER_NUMBER', '01', 1000.00, 'PHONE_NUMBER'); print_r($response);
API Documentation
For full API documentation, please refer to the Nellobytes Systems API.
Testing
composer test
License
The MIT License (MIT). Please see License File for more information.