starnerz/laravel-daraja
Laravel Daraja wraps all seventeen Safaricom M-Pesa Daraja APIs in ordinary Laravel code: STK Push, C2B, B2C, B2B, Dynamic QR, Ratiba, Bill Manager, typed responses, cached tokens, and testable callbacks. PHP 8.3+, Laravel 12/13.
A full rewrite. See the upgrade guide.
Daraja. MpesaApi and the Requests\* classes are
replaced by the Apis\* namespace, resolved through the container.stdClass. The decoded array
remains available on ->raw.ApiRequestException replaces MpesaApiRequestException, and now carries
errorCode, requestId, status and payload.stk_push.* to stk.*, c2b_url.* to
urls.c2b.*, result_url.* to urls.result.*, logs.* to logging.*.push() argument order changed: the account reference now precedes the
description.OriginatorConversationID, which the package generates.mode, where earlier versions bundled
only the production one and used it for sandbox too.Daraja::validateC2BUsing() for the synchronous C2B validation decision.VerifySafaricomIp middleware for restricting callbacks by source address.AccountBalances, which unpacks the delimited balance string into named
accounts.daraja:token and daraja:credential commands.STK::push() was uncallable. A required parameter followed an optional
one, so the signature in v1's own README raised an ArgumentCountError.str_limit() was removed in Laravel 6, breaking every STK push.daraja:register-urls read the wrong config namespace (mpesaapi.*
rather than laravel-daraja.*), so it always sent empty URLs.monolog/monolog ^2 conflicted with Laravel 11+. The package now logs
through Laravel's logger.ConfigurationException naming the key or path
instead of surfacing as a PHP warning promoted to ErrorException.Laravel 8 support. Together with 3.0.0 and 2.0.0, released the same day, this tracked successive Laravel majors over the 1.x codebase.
Initial releases supporting M-Pesa Express, C2B, B2C, B2B, Account Balance, Transaction Status and Reversal on Laravel 5.5+.
How can I help you explore Laravel packages today?