PHPackages                             mossey/mpesa - 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. mossey/mpesa

ActivePackage

mossey/mpesa
============

A PHP package for Mpesa API

1.0.3(8y ago)6604mitPHPPHP &gt;=5.3.0

Since Oct 15Pushed 8y ago5 watchersCompare

[ Source](https://github.com/mossey/Mpesa)[ Packagist](https://packagist.org/packages/mossey/mpesa)[ RSS](/packages/mossey-mpesa/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)DependenciesVersions (5)Used By (0)

**This package has been abandoned please use **

**Introduction**

This package seeks to help php developers implement the various Mpesa APIs without much hustle. It is based on the REST API whose documentation is available on .

**Installation using composer**
`composer require mossey/mpesa`

**Configuration**
At your project root, create a .env file and in it set the consumer key and consumer secret as follows
`consumer_key= [consumer key]`
`consumer_secret=[consumer secret]`
For Laravel users, open the Config/App.php file and add `\Mossey\Mpesa\MpesaServiceProvider::class` under providers and ` 'Mpesa'=> \Mossey\Mpesa\MpesaServiceProvider::class` under aliases.

**Usage**

**Confirmation and validation urls**

**B2C Payment Request**

This creates transaction between an M-Pesa short code to a phone number registered on M-Pesa.

`$mpesa= new \Mossey\Mpesa\Mpesa();`

`$b2cTransaction=$mpesa->b2c( $ShortCode, $CommandID, $Amount, $Msisdn, $BillRefNumber );`

**Account Balance Request**

This is used to enquire the balance on an M-Pesa BuyGoods (Till Number)

`$mpesa= new \Mossey\Mpesa\Mpesa();`

`$balanceInquiry=$mpesa->accountBalance($CommandID, $Initiator, $SecurityCredential, $PartyA, $IdentifierType, $Remarks, $QueueTimeOutURL, $ResultURL);`

**Transaction Status Request**This is used to check the status of transaction.

`$mpesa= new \Mossey\Mpesa\Mpesa();`

`$trasactionStatus=$mpesa->transactionStatus($Initiator, $SecurityCredential, $CommandID, $TransactionID, $PartyA, $IdentifierType, $ResultURL, $QueueTimeOutURL, $Remarks, $Occasion);`

**B2B Payment Request**

This is used to transfer funds between two companies.

`$mpesa= new \Mossey\Mpesa\Mpesa();`

`$b2bTransaction=$mpesa->b2b($ShortCode, $CommandID, $Amount, $Msisdn, $BillRefNumber );`

**STK Push Simulation**

This is used to initiate online payment on behalf of a customer.

`$mpesa= new \Mossey\Mpesa\Mpesa();`

`$stkPushSimulation=$mpesa->STKPushSimulation($BusinessShortCode, $LipaNaMpesaPasskey, $TransactionType, $Amount, $PartyA, $PartyB, $PhoneNumber, $CallBackURL, $AccountReference, $TransactionDesc, $Remarks);`

**STK Push Status Query**

This is used to check the status of a Lipa Na M-Pesa Online Payment.

`$mpesa= new \Mossey\Mpesa\Mpesa();`

`$STKPushRequestStatus=$mpesa->STKPushQuery($checkoutRequestID,$businessShortCode,$password,$timestamp);`

**Confirmation and Validation**

These are required in order to complete most of the transaction. Without these the transactions won't be complete. Therefore, register your URLS in the developer portal and soon as you're done be sure to ensure your validation URL and confirmation URL contain the following.

**Validation**

`$mpesa= new \Mossey\Mpesa\Mpesa();`

`$b2bTransaction=$mpesa->validate();`

**Confirmation**

`$mpesa= new \Mossey\Mpesa\Mpesa();`

`$b2bTransaction=$mpesa->confirm();`

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 90% 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 ~6 days

Total

4

Last Release

3114d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9869190854f924936e2c99d5a02dcfbc0d26157ed1c854b74fd62912f8b22e44?d=identicon)[mossey](/maintainers/mossey)

---

Top Contributors

[![mossey](https://avatars.githubusercontent.com/u/5586471?v=4)](https://github.com/mossey "mossey (9 commits)")[![mjacobus](https://avatars.githubusercontent.com/u/226834?v=4)](https://github.com/mjacobus "mjacobus (1 commits)")

### Embed Badge

![Health badge](/badges/mossey-mpesa/health.svg)

```
[![Health](https://phpackages.com/badges/mossey-mpesa/health.svg)](https://phpackages.com/packages/mossey-mpesa)
```

PHPackages © 2026

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