PHPackages                             me12free/laravel-mpesa-stkpush-sandbox - 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. me12free/laravel-mpesa-stkpush-sandbox

ActiveLibrary[API Development](/categories/api)

me12free/laravel-mpesa-stkpush-sandbox
======================================

A free Laravel package for integrating M-Pesa STK Push (sandbox/testing) with best practices.

v1.0.0(10mo ago)31MITPHPPHP &gt;=8.0CI failing

Since Jun 21Pushed 10mo agoCompare

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

READMEChangelogDependencies (4)Versions (2)Used By (0)

Laravel M-Pesa STK Push Sandbox
===============================

[](#laravel-m-pesa-stk-push-sandbox)

[![Tests](https://github.com/me12free/laravel-mpesa-stkpush-sandbox/actions/workflows/tests.yml/badge.svg)](https://github.com/me12free/laravel-mpesa-stkpush-sandbox/actions)[![License: MIT](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](LICENSE)[![Buy Me a Coffee](https://camo.githubusercontent.com/3001da54684fe55461bc0058deff53eb268b3fe611992c17fe25a5c31ea8c80d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275792532304d6525323061253230436f666665652d537570706f7274253230746865253230417574686f722d6f72616e67653f6c6f676f3d6275792d6d652d612d636f66666565266c6f676f436f6c6f723d7768697465)](https://coff.ee/johnekiru7v)[![GitHub stars](https://camo.githubusercontent.com/33912cdfdf47d1212468ff598a3df6fdb25b335e9171613d26aaf5cbc8e03d4f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6d653132667265652f6c61726176656c2d6d706573612d73746b707573682d73616e64626f783f7374796c653d736f6369616c)](https://github.com/me12free/laravel-mpesa-stkpush-sandbox/stargazers)

A modern, open-source Laravel package for integrating M-Pesa STK Push (sandbox/testing) with best practices. Focused on developer experience, security, and easy integration.

---

Table of Contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Quick Start](#quick-start)
- [Configuration](#configuration)
- [Usage Example](#usage-example)
- [Callback Handling](#callback-handling)
- [Testing](#testing)
- [Contributing &amp; Feedback](#contributing--feedback)
- [Support](#support)
- [Author](#author)
- [License](#license)

---

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

[](#requirements)

- PHP &gt;= 8.0
- Laravel &gt;= 9.0

---

Quick Start
-----------

[](#quick-start)

```
composer require me12free/laravel-mpesa-stkpush-sandbox
```

### Publish Config &amp; Migration

[](#publish-config--migration)

```
php artisan vendor:publish --provider="MpesaSandbox\MpesaSandboxServiceProvider" --tag=config
php artisan vendor:publish --provider="MpesaSandbox\MpesaSandboxServiceProvider" --tag=migrations
```

---

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

[](#configuration)

Add to your `.env`:

```
MPESA_CONSUMER_KEY=your_sandbox_consumer_key
MPESA_CONSUMER_SECRET=your_sandbox_consumer_secret
MPESA_SHORTCODE=174379
MPESA_PASSKEY=your_sandbox_passkey
MPESA_CALLBACK_URL=https://your-ngrok-url/api/mpesa/callback?secret=your_shared_secret
MPESA_CALLBACK_SECRET=your_shared_secret
```

---

Usage Example
-------------

[](#usage-example)

```
use MpesaSandbox\MpesaSandbox;

$mpesa = app(MpesaSandbox::class);
$response = $mpesa->initiateStkPush('2547XXXXXXXX', 10);
```

---

Callback Handling
-----------------

[](#callback-handling)

See [`README-callback.md`](README-callback.md) for a full example controller and route.

**Security:** Always verify the shared secret in your callback controller:

```
if ($request->query('secret') !== env('MPESA_CALLBACK_SECRET')) {
    abort(403, 'Invalid secret');
}
```

---

Testing
-------

[](#testing)

This package uses [Pest](https://pestphp.com/) and [Orchestra Testbench](https://github.com/orchestral/testbench) for isolated, modern package testing.

```
composer install
vendor/bin/pest
```

---

Contributing &amp; Feedback
---------------------------

[](#contributing--feedback)

Pull requests are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) guide (or open an issue for questions).

- **Star this repo:** If you like this package, please [star it on GitHub](https://github.com/me12free/laravel-mpesa-stkpush-sandbox/stargazers) to show your support!
- **Rate on Packagist:** [Leave a rating or review on Packagist](https://packagist.org/packages/me12free/laravel-mpesa-stkpush-sandbox) if you find it useful.
- **Become a contributor:** Open a pull request or issue to join the contributors list. See [CONTRIBUTING.md](CONTRIBUTING.md) for full guidelines.

---

Support
-------

[](#support)

If you find this package useful, consider supporting development:

[![Buy Me a Coffee](https://camo.githubusercontent.com/9f44ce2dc3b3eecdd02598900866ffc518801df1932849703dae1e5ce5031070/68747470733a2f2f7777772e6275796d6561636f666665652e636f6d2f6173736574732f696d672f637573746f6d5f696d616765732f6f72616e67655f696d672e706e67)](https://coff.ee/johnekiru7v)

For help or questions, open an issue or email .

---

Author
------

[](#author)

John Ekiru ()

License
-------

[](#license)

MIT — see [LICENSE](LICENSE)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance53

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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

Unknown

Total

1

Last Release

326d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9ae554ff2708eab11727a9e4d4e4396508d679b680378181d1a19c5b6fd1ee1c?d=identicon)[me12free](/maintainers/me12free)

---

Top Contributors

[![me12free](https://avatars.githubusercontent.com/u/84097667?v=4)](https://github.com/me12free "me12free (6 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/me12free-laravel-mpesa-stkpush-sandbox/health.svg)

```
[![Health](https://phpackages.com/badges/me12free-laravel-mpesa-stkpush-sandbox/health.svg)](https://phpackages.com/packages/me12free-laravel-mpesa-stkpush-sandbox)
```

###  Alternatives

[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.1M28](/packages/mollie-laravel-mollie)[mll-lab/laravel-graphiql

Easily integrate GraphiQL into your Laravel project

683.2M9](/packages/mll-lab-laravel-graphiql)[spatie/laravel-route-discovery

Auto register routes using PHP attributes

23645.0k2](/packages/spatie-laravel-route-discovery)[esign/laravel-conversions-api

A laravel wrapper package around the Facebook Conversions API

69145.4k](/packages/esign-laravel-conversions-api)[didww/didww-api-3-php-sdk

PHP SDK for DIDWW API 3

1218.2k](/packages/didww-didww-api-3-php-sdk)[surface/laravel-webfinger

A Laravel package to create an ActivityPub webfinger.

113.8k](/packages/surface-laravel-webfinger)

PHPackages © 2026

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