Download the PHP package karson/mpesa-php-sdk without Composer

On this page you can find all versions of the php package karson/mpesa-php-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-php-sdk

Mpesa Mozambique PHP SDK

Latest Version on Packagist Build Status Quality Score Total Downloads

A comprehensive PHP SDK for integrating with M-Pesa Mozambique APIs. This package provides a clean, modern interface for all M-Pesa operations with robust error handling, callback processing, and extensive validation.

Features

Installation

You can install the package via composer:

Usage

Basic Setup

Customer to Business (C2B) Transactions

Business to Customer (B2C) Transactions

Transaction Status Query

Customer Name Query

Business to Business (B2B) Transactions

Transaction Refund/Reversal

Response Objects

All methods return strongly typed response objects based on a unified architecture:

BaseResponse (Unified Response Class)

All transaction responses now inherit from BaseResponse with common methods:

Transaction Response Classes

Transaction Status Response Methods

Customer Name Response Methods

Refund/Reversal Response Methods

Response Class Architecture

The SDK v2.0 features a completely refactored response architecture that eliminates ~90% of code duplication:

Key Improvements:

Project Structure

The SDK v2.0 features a streamlined, organized structure:

Key Architectural Improvements:

API Reference

For detailed API documentation including all endpoints, request/response parameters, and examples, see the API Documentation.

Laravel Integration

Installation in Laravel

Add the following environment variables to your .env file:

Service Provider Registration

The package includes a Laravel service provider that automatically registers the M-Pesa service. You can inject it into your controllers:

Error Handling

All response objects provide comprehensive error information with the unified API:

Response Structure

Unified Transaction Responses

All transaction methods (C2B, B2C, B2B) now return a unified TransactionResponse object:

Transaction Status Tracking

Use the conversation ID to track transaction status:

Exception Handling

The SDK provides comprehensive error handling with custom exceptions:

Exception Types

Token Management

The SDK includes intelligent token management with caching and optimization:

Token Management Features

Best Practices

Parameter Validation

The SDK includes built-in parameter validation to ensure data integrity:

Response Code Constants

Use predefined constants for consistent response handling:

Testing

The SDK includes comprehensive unit tests to ensure reliability:

Test Coverage

The test suite covers:

Running Tests

What's New in v2.0

🚀 Major Improvements

🔄 Breaking Changes

Response Classes Unified

Removed getData() Method

📦 New Features

Enhanced Response Methods

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

PHP Package Boilerplate

This package was generated using the PHP Package Boilerplate.


All versions of mpesa-php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
guzzlehttp/guzzle Version ^7.0
ext-curl Version *
ext-json Version *
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 karson/mpesa-php-sdk contains the following files

Loading the files please wait ....