PHP API for Mobile phone TOPUP
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
src
tests
.gitignore
LICENSE
README.md
VERSION.txt
composer.json
phpunit.xml.dist

README.md

Airtime

PHP API for Mobile phone TOPUP N|Solid

PHP TOPUP API via the CAMOO AIRTIME gateway

Requirement

This library needs minimum requirement for doing well on run.

  • 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.

composer require camoo/airtime

Quick Examples

  1. Get available general info about destination msisdn
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();
  1. Check available topup list and wholsale price list
  $sTopupList = $ohMsisdnInfo->msisdn_info->topup_list;
  // your prices for each topup product
  $sWholeSalePriceList = $ohMsisdnInfo->msisdn_info->wholesale_price_list;
  1. Choose a topup amount from the key topup_list and send airtime
// airtime from
$oAirtime->msisdn= '237661562859';
// airtime product
$oAirtime->topup=100;
var_dump($oAirtime->send());

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:

  1. Go to library root cd vendor/camoo/airtime
  2. Copy phpunit.xml.dist to phpunit.xml.
  3. Run phpunit tests.