PHPackages                             payherokenya/payhero-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. [Payment Processing](/categories/payments)
4. /
5. payherokenya/payhero-php

ActiveLibrary[Payment Processing](/categories/payments)

payherokenya/payhero-php
========================

This PHP client library enables easy interaction with the PayHero API, allowing developers to integrate PayHero's payment processing capabilities into their PHP applications. With this client, you can perform operations like checking wallet balances, topping up service wallets, initiating payments, and querying transaction statuses.To be able to generate API keys with Pay Hero to use our API services you need to create an account with us. Create an account using below link and verify your account to be able to proceed. Go To: https://app.payhero.co.ke

1.0.1(2y ago)31204MITPHPPHP &gt;=7.0

Since Apr 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/PAY-HERO-KENYA/payhero-php-package)[ Packagist](https://packagist.org/packages/payherokenya/payhero-php)[ Docs](https://github.com/PAY-HERO-KENYA/payhero-php-package.git)[ RSS](/packages/payherokenya-payhero-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PayHeroAPI PHP Client
=====================

[](#payheroapi-php-client)

This PHP client library enables easy interaction with the PayHero API, allowing developers to integrate PayHero's payment processing capabilities into their PHP applications. With this client, you can perform operations like checking wallet balances, topping up service wallets, initiating payments, and querying transaction statuses.

To be able to generate API keys with Pay Hero to use our API services you need to create an account with us. Create an account using below link and verify your account to be able to proceed. Go To:

Features
--------

[](#features)

- **Wallet Balance Inquiry:** Check the balance of service and payment wallets.
- **Wallet Top-Up:** Top up service wallets with a specified amount.
- **Payment Processing:** Send customer M-Pesa STK Push for payment collection.
- **Transaction Status:** Check the status of a specific transaction.
- **Account Transactions:** Retrieve a list of transactions for an account.
- **SasaPay Payments:** Process payments through SasaPay.
- **Withdrawals:** Withdraw funds to mobile or bank accounts via SasaPay.

Installation
------------

[](#installation)

To get started run this command in your terminal:

```
composer require payherokenya/payhero-php
```

To use this PHP client in your project, simply include the `PayHeroAPI` class in your PHP script.

```
require_once 'vendor/payherokenya/payhero-php/ph-class.php';
```

Usage
-----

[](#usage)

### Initializing the Client

[](#initializing-the-client)

```
$apiUsername = 'your_api_username';
$apiPassword = 'your_api_password';
$payHeroAPI = new PayHeroAPI($apiUsername, $apiPassword);
```

### Checking Wallet Balances

[](#checking-wallet-balances)

```
$serviceWalletBalance = $payHeroAPI->getServiceWalletBalance();
$paymentWalletBalance = $payHeroAPI->getPaymentWalletBalance();
```

### Topping Up Service Wallet

[](#topping-up-service-wallet)

```
$topUpResponse = $payHeroAPI->topUpServiceWallet($amount, $phone);
```

### Sending Customer M-Pesa STK Push

[](#sending-customer-m-pesa-stk-push)

```
$stkPushResponse = $payHeroAPI->SendCustomerMpesaStkPush($amount, $phone, $channel_id, $external_reference, $callback_url);
```

### Checking Transaction Status

[](#checking-transaction-status)

```
$transactionStatus = $payHeroAPI->getTransactionStatus($reference);
```

### Get Account Transactions

[](#get-account-transactions)

```
$accountTransactions = $payHeroAPI->getAccountTransactions($reference);
```

### Processing SasaPay Payments

[](#processing-sasapay-payments)

```
$sasapayPaymentResponse = $payHeroAPI-> sasaPayPayment($amount,$phone,$network_code,$external_reference,$callback_url);
```

### Making Withdrawals To Mobile

[](#making-withdrawals-to-mobile)

```
$withdrawalResponse = $payHeroAPI->sasaPayWithdrawToMobile($amount,$phone,$network_code,$external_reference,$callback_url);
```

### Making Withdrawals To Bank

[](#making-withdrawals-to-bank)

```
$withdrawalResponse = $payHeroAPI->sasaPayWithdrawToBank($amount,$account_number,$network_code,$external_reference,$callback_url);
```

Requirements
------------

[](#requirements)

- PHP 7.0 or newer
- cURL support enabled in PHP

Contributing
------------

[](#contributing)

Contributions to the PayHeroAPI PHP client are welcome. Please ensure that your code adheres to the existing style and that all tests pass.

License
-------

[](#license)

This project is licensed under the MIT License - see the LICENSE file for details.

Author
------

[](#author)

Pay Hero Kenya LTD

Maintainers
-----------

[](#maintainers)

- [Pay Hero Kenya LTD](https://github.com/PAY-HERO-KENYA)

Version
-------

[](#version)

1.0.1

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

763d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a714efbc2c8664de77bc0a085881226d7cab2080ab5fb5152f5542f012b78ec?d=identicon)[ronniengoda](/maintainers/ronniengoda)

---

Top Contributors

[![ronniengoda](https://avatars.githubusercontent.com/u/34179984?v=4)](https://github.com/ronniengoda "ronniengoda (12 commits)")

---

Tags

shopifywoocommercempesa-apipayheropayhero\_kenyapayment\_api

### Embed Badge

![Health badge](/badges/payherokenya-payhero-php/health.svg)

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

###  Alternatives

[karson/mpesa-php-sdk

172.2k](/packages/karson-mpesa-php-sdk)

PHPackages © 2026

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