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

ActiveLibrary

kiveu/mpesa
===========

This is a PHP SDK for the M-Pesa API for Mpesa Daraja API 2.0 2024

1.1.0(1y ago)6416↓100%6MITPHPPHP ^7.4 || ^8.0

Since Apr 17Pushed 1y ago2 watchersCompare

[ Source](https://github.com/alvin-kiveu/Mpesa-Daraja-Api-Php-Sdk)[ Packagist](https://packagist.org/packages/kiveu/mpesa)[ RSS](/packages/kiveu-mpesa/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

Mpesa Daraja Api Php Sdk
========================

[](#mpesa-daraja-api-php-sdk)

This is a php sdk for the new Mpesa Daraja Api. It is still in development and will be updated as the api changes.

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

[](#installation)

You can install the package via composer:

```
composer require kiveu/mpesa
```

dev version

```
composer require kiveu/mpesa:dev-main
```

UNDER DEVELOPMENT

Usage
-----

[](#usage)

```
use Kiveu\Mpesa\StkPush;

$stkpush = new StkPush();

$stkpush->initiate($phone_number, $amount, $reference, $description);
```

Testing
-------

[](#testing)

```
composer test
```

ENVIRONMENT VARIABLES
---------------------

[](#environment-variables)

```
MPESA_ENV= production # or sandbox >
MPESA_CONSUMER_KEY= add your consumer key
MPESA_CONSUMER_SECRET= add your consumer secret
MPESA_PASSKEY= add your passkey
MPESA_SHORTCODE= add your shortcode
MPESA_SHORTCODE_TYPE= Paybill # or BuyGoods
MPESA_BUY_GOODS_TILL= add your buy goods till
MPESA_CALLBACK_URL= add your callback url
MPESA_INITIATOR_NAME= add your initiator name
MPESA_INITIATOR_PASSWORD= add your initiator password
MPESA_B2C_SHORTCODE= add your b2c shortcode
MPESA_B2C_COMMAND_ID= add your b2c command id eg SalaryPayment, BusinessPayment, PromotionPayment
MAPESA_C2B_VERSION= add your c2b version v1 or v2
MPESA_CONFIRMATION_URL= add your confirmation url
MPESA_VALIDATION_URL= add your validation url
MPESA_RESULT_URL= add your result url
KRA_SHORT_CODE= add your kra shortcode
```

###  Health Score

31

—

LowBetter than 71% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity46

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 ~70 days

Total

2

Last Release

634d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/59992f6673f2b7eb52a66e6ff5e4c514447494c7f162606b718384c9c9929faa?d=identicon)[alvin-kiveu](/maintainers/alvin-kiveu)

---

Top Contributors

[![alvin-kiveu](https://avatars.githubusercontent.com/u/67068458?v=4)](https://github.com/alvin-kiveu "alvin-kiveu (30 commits)")

---

Tags

mpesampesa-apimpesa-laravelmpesa-paymentsmpesa-sdkphp-mpesa-sdksdk-php

### Embed Badge

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

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

PHPackages © 2026

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