safaricom/mpesa
Laravel package for Safaricom M-Pesa integration, simplifying STK Push, C2B, B2C, transaction status, and callback handling. Configure credentials, initiate payments, and reconcile responses with clean, expressive PHP APIs built for Laravel applications.
.env parameter parsing) nudges the estimate on option (b) down slightly — it removes a small amount of config-ripping work from the fork — but does not change the shape of the decision..env parsing is a signal of low but nonzero upstream activity, not a signal of renewed investment; do not upgrade your confidence in its long-term support based on it.Consider it when:
.env parameter parsing means sandbox keys, shortcodes, and passkeys can be swapped per environment without editing files. This is a genuine convenience for spikes and local/sandbox work.Look elsewhere (or budget to fork) when:
.env patch is a convenience fix, not a modernization — the endpoint and payload assumptions are still vintage-2019. Expect breakage in production and no reliable upstream fixes..env parsing is configuration, not secrets management — it is not the same as a Laravel service provider with publishable config, encrypted secrets, environment-aware validation, or key rotation. Treat the gap as narrow-but-real: the "can I configure it per environment" objection is now largely retired; the "is it safe to hold live merchant credentials" objection is not..env is a single global environment — it works against you here, since multi-tenant credential isolation is the opposite of process-wide env vars..env does not constitute an audit trail or a control.Decision heuristic: treat it as documentation with executable examples, not as a dependency. If a maintained community SDK or a managed provider is available, compare total cost of ownership — a weekend fork is now marginally cheaper than before 1.0.8, but an unmaintained critical-path payment dependency is still not cheap. The heuristic is unchanged.
To executives: M-Pesa is the payment rail we need to enter Kenya, and this is Safaricom's own PHP SDK — which buys us credibility and a head start, but not a product. Its recent 1.0.8 release is a small developer-convenience fix (reading credentials from environment files); it is not a sign that the SDK is being actively invested in or supported. My recommendation is unchanged: use it as a spec and starting point and budget roughly [X engineer-weeks] to harden or wrap it before it touches real money — the latest release shaves a little off that estimate, not the risk. That's still far cheaper than building the integration from zero, and it de-risks the market-entry timeline. The decision I need is whether to fund that hardening work now, or defer Kenya until we've chosen a managed payments provider that includes M-Pesa.
To engineering: This gives us the Daraja request/response shapes and the tricky bits — password/security-credential generation, STK Push, C2B, B2C, status queries — for free, and as of 1.0.8 it will read config from .env instead of requiring hardcoded credentials, so sandbox setup is quicker. It still does not give us callback verification, idempotency, retries, reconciliation, a secrets-management story beyond plain env vars, or a Laravel service provider. Plan to vendor it, pin it, wire it into Laravel's own config/ rather than leaning on its env parser, wrap it behind our own MpesaClient interface, and write tests against sandbox. Assume no upstream patches beyond cosmetic ones; anything we need, we own.
To finance/legal: Any integration we ship becomes a money-movement path, which brings reconciliation, dispute handling, and Kenya DPA/CBK obligations into scope. Those are ours to satisfy regardless of which SDK we pick; this package provides no compliance surface — and moving credentials into a .env file is a hygiene improvement, not a control or an audit trail. Don't let "Safaricom publishes it" read as "Safaricom warrants it."
How can I help you explore Laravel packages today?