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

ActiveLibrary

silahkosgei/mpesa
=================

Laravel M-PESA Integration Package

1.1.7(10mo ago)026MITPHPPHP ^8.0

Since Jul 9Pushed 10mo agoCompare

[ Source](https://github.com/silahkosgei/mpesa)[ Packagist](https://packagist.org/packages/silahkosgei/mpesa)[ RSS](/packages/silahkosgei-mpesa/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (8)Used By (0)

Laravel M-PESA Integration Package
==================================

[](#laravel-m-pesa-integration-package)

A Laravel package for integrating with Safaricom's M-PESA STK Push and B2C APIs. Simple, extensible, and production-ready.

---

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

[](#installation)

```
composer require SilahKosgei/mpesa:^1.1
```

Then publish the configuration file:

```
php artisan vendor:publish --tag=mpesa-config
```

---

Configuration
-------------

[](#configuration)

Add these to your `.env` file:

```
MPESA_ENV=sandbox                      # or production
MPESA_SHORTCODE=601234
MPESA_BUY_GOODS_TILL=174379
MPESA_SHORTCODE_TYPE=PayBill          # or BuyGoods
MPESA_PASSKEY=YOUR_PASSKEY_HERE
MPESA_CONSUMER_KEY=YOUR_CONSUMER_KEY
MPESA_CONSUMER_SECRET=YOUR_CONSUMER_SECRET
MPESA_CALLBACK_URL=https://yourapp.com/api/complete-payment
MPESA_CONFIRMATION_URL=https://yourapp.com/api/confirmation-payment
```

---

Usage
-----

[](#usage)

### Initiate STK Push

[](#initiate-stk-push)

```
use SilahKosgei\Mpesa\Mpesa;

$mpesa = new Mpesa();

$response = $mpesa->initiateStkPush(
    '254712345678',                  // phone
    100,                             // amount
    'ORDER-12345',                   // account reference
    'Payment for Order #12345',      // description
    12345                            // reference ID for callback
);
```

### Lookup STK Push Payment

[](#lookup-stk-push-payment)

```
$response = $mpesa->lookupPayment('ws_CO_123456789');
```

---

👤 Author
--------

[](#-author)

**Silh Kosgei**
📧
🔗 [GitHub: @silahkosgei](https://github.com/silahkosgei)

---

Version
-------

[](#version)

**v1.1.1**

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance54

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community6

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

Total

7

Last Release

305d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7b648f65117d4c8bed23022b780013a51ec6cd6ef20fdd54b55d7d596da56a25?d=identicon)[silahkosgei](/maintainers/silahkosgei)

---

Top Contributors

[![silahpapa](https://avatars.githubusercontent.com/u/33021406?v=4)](https://github.com/silahpapa "silahpapa (14 commits)")

### Embed Badge

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

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

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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