PHPackages                             jilenloa/tppmyone4all-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. jilenloa/tppmyone4all-php

ActiveLibrary[API Development](/categories/api)

jilenloa/tppmyone4all-php
=========================

PHP Library to integration myone4all tpp service easily

1.0.3(2y ago)04191MITPHPPHP &gt;=5.5CI failing

Since Oct 28Pushed 1y ago1 watchersCompare

[ Source](https://github.com/jilenloa/tppmyone4all-php)[ Packagist](https://packagist.org/packages/jilenloa/tppmyone4all-php)[ RSS](/packages/jilenloa-tppmyone4all-php/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (5)Dependencies (3)Versions (8)Used By (0)

Tpp One4All Library for PHP
===========================

[](#tpp-one4all-library-for-php)

[![Latest Version](https://camo.githubusercontent.com/906618073a26f84a110caa49d6eb13c4f2231e58eb8f431fe4629ac018f904bd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6a696c656e6c6f612f7470706d796f6e6534616c6c2d7068702e7376673f7374796c653d666c61742d737175617265)](https://github.com/jilenloa/tppmyone4all-php/releases)[![Build Status](https://camo.githubusercontent.com/c5555846c4d4b5f316a116936ec785e686dd4cae44dc98809256c918fd78fc45/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6a696c656e6c6f612f7470706d796f6e6534616c6c2d7068702f43493f7374796c653d666c61742d737175617265)](https://github.com/jilenloa/tppmyone4all-php/actions)[![Total Downloads](https://camo.githubusercontent.com/dc12df5cc6652bbc61bdc4e3022ecc4c4087bd687da706ae59f35f6a80ee0745/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a696c656e6c6f612f7470706d796f6e6534616c6c2d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jilenloa/tppmyone4all-php)

This library makes it easy for PHP developers to integrate with One4All TPP online service.

It's supported on PHP 5.5+

Using the Library
-----------------

[](#using-the-library)

```
use MyOne4All\TppClient;
use MyOne4All\Exceptions\TppException;
use MyOne4All\Models\DataBundle;
use MyOne4All\NetworkCodes;

$tppClient = new TppClient("apikey", "apisecret", "retailer");
```

Get Balance
-----------

[](#get-balance)

```
# ecredit balance
echo $tppClient->getBalance(); # 0.0

# mobile money collection balance
echo $tppClient->getBalance(TppClient::WALLET_TYPE_MOBILE_MONEY_COLLECTION); # 0.0

# mobile money credit balance
echo $tppClient->getBalance(TppClient::WALLET_TYPE_MOBILE_MONEY_CREDIT); # 0.0
```

Send Airtime
------------

[](#send-airtime)

```
// send airtime implementation
$airtime_response = $tppClient->sendAirtime("0245667942", 1, "trans03423423", NetworkCodes::AUTO_DETECT);
if($airtime_response->isSuccessful()){
    echo "airtime sent";
}else{
    echo "Failed: ".$airtime_response->getErrorMessage();
}
```

Send Data Bundle
----------------

[](#send-data-bundle)

```
// send internet data implementation
$data_code = "DAILY_20MB";
$transaction_reference = "trans03423423";
$bundle_response = $tppClient->sendDataBundle("0245667942", $data_code, $transaction_reference, NetworkCodes::MTN_GH);
if($bundle_response->isSuccessful()){
    echo "internet bundle sent";
}else{
    echo "Failed: ".$bundle_response->getErrorMessage();
}
```

Send Flexi Data Bundle
----------------------

[](#send-flexi-data-bundle)

```
// send internet data implementation
$data_code = "flexi_data_bundle";
$transaction_reference = "trans03423423";
$amount = 10;
$bundle_response = $tppClient->sendFlexiDataBundle("0245667942", $amount, $data_code, $transaction_reference, NetworkCodes::MTN_GH);
if($bundle_response->isSuccessful()){
    echo "internet bundle sent";
}else{
    echo "Failed: ".$bundle_response->getErrorMessage();
}
```

Send Mobile Money
-----------------

[](#send-mobile-money)

```
// send mobile money implementation
$transaction_reference = "trans03423423";
$amount = 1;
$momo_response = $tppClient->sendMobileMoney("0245667942", $amount, $transaction_reference);
if($momo_response->isSuccessful()){
    echo "mobile money sent";
}else if($momo_response->isPending()){
    // this is very important, do not treat as an error.
    // you must check transaction status later to know if it was successful or not
    echo "mobile money request is being processed.";
}else{
    echo "Failed: ".$momo_response->getErrorMessage();
}
```

Receive Mobile Money
--------------------

[](#receive-mobile-money)

```
// receive mobile money implementation
$transaction_reference = "trans03423423";
$amount = 1;
$payer_number = "0245667XXX";
$momo_response = $tppClient->receiveMobileMoney($payer_number, $amount, $transaction_reference);
if($momo_response->isSuccessful()){
    // check transaction status later to confirm receipt
    echo "mobile money payment request initiated";
}else{
    echo "Failed: ".$momo_response->getErrorMessage();
}
```

Receive Mobile Money on USSD
----------------------------

[](#receive-mobile-money-on-ussd)

When working with USSD sessions, it is important there is a delay between the closing of the current session and the payment prompt. Use the delay parameter to specify the number of seconds to delay the payment prompt after the current USSD session ends.

```
// receive mobile money implementation
$transaction_reference = "trans03423423";
$amount = 1;
$payer_number = "0245667XXX";
$narration = "Food Purchase";
$delay = 5;
// the last parameter represents the number of seconds to delay the payment prompt
$momo_response = $tppClient->receiveMobileMoney($payer_number, $amount, $transaction_reference, $delay, $narration);
if($momo_response->isSuccessful()){
    // check transaction status later to confirm receipt
    echo "mobile money payment request initiated";
}else{
    echo "Failed: ".$momo_response->getErrorMessage();
}
```

Send SMS
--------

[](#send-sms)

```
$sms_message = "hello world";
$sms_sender_id = "One4All";
$transaction_reference = "sms11";
$sms_response = $tppClient->sendSms("0572180376", $sms_message, $sms_sender_id, $transaction_reference);
if($sms_response->isSuccessful()){
    echo "sms message queued";
}else{
    echo "Failed: ".$sms_response->getErrorMessage();
}
```

Query Bundle List
-----------------

[](#query-bundle-list)

We recommend you cache this list for at least 24 hours to avoid unnecessary API calls.

```
echo NetworkCodes::AUTO_DETECT; # 0
echo NetworkCodes::MTN_GH; # 4
echo NetworkCodes::AIRTEL_DRC; # 2

// fetch available data packages for all networks
$data_packages = $tppClient->getDataBundleList();

// only fetch data packages for mtn
$data_packages = $tppClient->getDataBundleList(NetworkCodes::MTN_GH);

foreach($data_pages as $data_package){
    echo $data_package->plan_id; # DAILY_20MB
    echo $data_package->plan_name; # DAILY_20MB
    echo $data_package->category; # DAILY
    echo $data_package->network_id; # 4
    echo $data_package->volume; # 20 MB
}
```

Query Transaction Status
------------------------

[](#query-transaction-status)

```
$transaction_reference = "trans03423423";
$transaction_status = $tppClient->getTransactionStatus($transaction_reference);
if($transaction_status == TppClient::TRANSACTION_STATUS_COMPLETED){
    echo "transaction successful";
}
```

Install package using Composer

```
composer require jilenloa/tppmyone4all-php
```

After installing, you need to require Composer's autoloader:

```
require 'vendor/autoload.php';
```

You can then later update the package later using composer:

```
composer update
```

In order to run unit tests for this package

```
npm install -g mockserver
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~246 days

Recently: every ~369 days

Total

7

Last Release

913d ago

Major Versions

0.0.5 → 1.0.02023-11-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/ed1cbb31d5b273172bda15e9de9f3534d3455acbed06feaa6af88234fa30b214?d=identicon)[jilenloa](/maintainers/jilenloa)

---

Top Contributors

[![jilenloa](https://avatars.githubusercontent.com/u/1678787?v=4)](https://github.com/jilenloa "jilenloa (32 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jilenloa-tppmyone4all-php/health.svg)

```
[![Health](https://phpackages.com/badges/jilenloa-tppmyone4all-php/health.svg)](https://phpackages.com/packages/jilenloa-tppmyone4all-php)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
