Airtime
PHP API for Mobile phone TOPUP
, (*1)
PHP TOPUP API via the CAMOO AIRTIME gateway, (*2)
Requirement
This library needs minimum requirement for doing well on run., (*3)
-
Sign up for a free CAMOO account
- Ask CAMOO Team for new access_key for developers
- CAMOO TOPUP API client for PHP requires version 5.5.x and above
Installation via Composer
Package is available on Packagist,
you can install it using Composer., (*4)
composer require camoo/airtime
Quick Examples, (*5)
1) Get available general info about destination msisdn, (*6)
require_once dirname(dirname(dirname(__DIR__))) . '/autoload.php';
// set api_key and secret_key
$oAirtime = new \CAMOO\Airtime\Airtime('592595095gh57', '4e32da5979879b89479847b9798479494984');
// receiver recipient
$oAirtime->destination_msisdn='237671234567';
#Retrieve MsisdnInfo
$ohMsisdnInfo = $oAirtime->getMsisdnInfo();
2) Check available topup list and wholsale price list, (*7)
$sTopupList = $ohMsisdnInfo->msisdn_info->topup_list;
// your prices for each topup product
$sWholeSalePriceList = $ohMsisdnInfo->msisdn_info->wholesale_price_list;
3) Choose a topup amount from the key topup_list and send airtime
php
// airtime from
$oAirtime->msisdn= '237661562859';
// airtime product
$oAirtime->topup=100;
var_dump($oAirtime->send());, (*8)
Running Tests
Assuming you have PHPUnit installed system wide using one of the methods stated
here, you can run the
tests for CAMOO/Aitime by doing the following:, (*9)
- Go to library root
cd vendor/camoo/airtime
- Copy
phpunit.xml.dist to phpunit.xml.
- Run
phpunit tests.