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.
Guzzle 8 support. The requirement is now ^7.8 || ^8.0.
Nothing in the package changes. This widens what it permits, so an application that has already moved to Guzzle 8 can install it at all — previously the resolver refused. Applications on Guzzle 7 are unaffected and need do nothing.
Both are covered by CI rather than assumed: Laravel 12 resolves Guzzle 7 and Laravel 13 resolves Guzzle 8, on PHP 8.3 and 8.4 alike.
[email protected] rather than a personal address. SECURITY.md is the authority; the README and CONTRIBUTING.md agree with it.starnerz.github.io/daraja-docs/ URLs redirect, so existing links keep working.Full changelog: https://github.com/starnerz/laravel-daraja/compare/v5.1.0...v5.2.0
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.composer require starnerz/laravel-daraja
Requires PHP 8.3 and Laravel 12 or 13. Applications on Laravel 10 or 11 should stay on ^4.0.
How can I help you explore Laravel packages today?