承接 me12free/laravel-mpesa-stkpush-sandbox 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

me12free/laravel-mpesa-stkpush-sandbox

最新稳定版本:v1.0.0

Composer 安装命令:

composer require me12free/laravel-mpesa-stkpush-sandbox

包简介

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

README 文档

README

Tests License: MIT Buy Me a Coffee GitHub stars

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

Requirements

  • PHP >= 8.0
  • Laravel >= 9.0

Quick Start

composer require me12free/laravel-mpesa-stkpush-sandbox

Publish Config & Migration

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

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

use MpesaSandbox\MpesaSandbox;

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

Callback Handling

See 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

This package uses Pest and Orchestra Testbench for isolated, modern package testing.

composer install
vendor/bin/pest

Contributing & Feedback

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

Support

If you find this package useful, consider supporting development:

Buy Me a Coffee

For help or questions, open an issue or email johnewoi72@gmail.com.

Author

John Ekiru (johnewoi72@gmail.com)

License

MIT — see LICENSE

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-21