Comprehensive PHP package for integrating with Safaricom's M-Pesa DARAJA API
All M-Pesa endpoints including B2Pochi and STK Status
Intelligent fallbacks for nested settings
Centralized logic for STK, C2B, and result notifications
Pre-configured Safaricom command IDs and response types
Command-aware field pruning and detailed error reporting
Works with any PHP project, sandbox and production ready
Initiate payment requests directly to customer phones
Check the status of STK Push requests
Send money from business to customer accounts
Transfer funds between business accounts
Send money to customer Pochi savings accounts
Register URLs and simulate customer payments
Query status of any M-Pesa transaction
Check balance and reverse erroneous transactions
composer require yourdudeken/mpesa
<?php
require "vendor/autoload.php";
use Yourdudeken\Mpesa\Init as Mpesa;
$mpesa = new Mpesa();
$response = $mpesa->STKPush([
'amount' => 100,
'phoneNumber' => '254722000000',
'accountReference' => 'ORDER-123'
]);