Download the PHP package ongudidan/mpesa-sdk without Composer

On this page you can find all versions of the php package ongudidan/mpesa-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mpesa-sdk

M-Pesa SDK for PHP

Overview

mpesa-sdk is a lightweight PHP SDK that simplifies integration with Safaricom's M-Pesa Daraja API. It supports B2C, B2B, C2B, STK Push, reversals, transaction status, account balance, and more.

This SDK is framework-agnostic, meaning you can use it with Laravel, Symfony, Yii, CodeIgniter, or even plain/vanilla PHP.


πŸ“¦ Installation

Install via Composer:


βš™οΈ Configuration

You'll need:

You can pass credentials directly in the data array or load them using environment variables/configuration.


πŸš€ Usage Examples


βœ… B2C (Business to Customer)

Send funds from your shortcode to a customer's phone.


πŸ’Ό Account Balance

Check your Paybill/Till balance.


πŸ” Transaction Status

Check the status of a transaction.


🏒 B2B (Business to Business)

Send money from your organization to another.


πŸ‘₯ C2B (Customer to Business Simulation)

Simulate a customer payment to your shortcode.


πŸ“² STK Push (Lipa Na M-Pesa)

Trigger a payment prompt on a customer's phone.


πŸ“‘ STK Push Query

Query the status of an STK Push request.


πŸ”„ Reversal

Reverse a transaction.


πŸ” Register Validation & Confirmation URLs

Register endpoints to handle C2B payments.


πŸ“₯ Handle Callback Data

Get Data from Callback:

Send Callback Response:


πŸ“₯ Handling M-PESA Daraja Callback Responses

To log the response from any M-PESA Daraja callback (e.g., C2B Confirmation, C2B Validation, STK Push, etc.), you can use the following snippet in your callback.php (or any relevant endpoint). This helps with debugging and record-keeping.

βœ… Best Practices:


πŸ“˜ More Info


πŸ›  Contributing

Pull requests and suggestions welcome! Let’s improve mobile money in PHP together.



All versions of mpesa-sdk with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ongudidan/mpesa-sdk contains the following files

Loading the files please wait ....