PHPackages                             openpesa/pesa - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. openpesa/pesa

ActiveLibrary[API Development](/categories/api)

openpesa/pesa
=============

Pesa PHP SDK

v0.1.0(4y ago)291.3k↑100%20[2 PRs](https://github.com/openpesa/php-pesa/pulls)2MITPHPPHP ^7.2|^8.0

Since Oct 16Pushed 2y ago7 watchersCompare

[ Source](https://github.com/openpesa/php-pesa)[ Packagist](https://packagist.org/packages/openpesa/pesa)[ Docs](https://github.com/openpesa/pesa)[ RSS](/packages/openpesa-pesa/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (14)Used By (2)

[![](./art/Openpesa_PHP.png)](./art/Openpesa_PHP.png)

Pesa SDK for PHP
================

[](#pesa-sdk-for-php)

> # Version 2 | Work in Progress 🚧
>
> [](#version-2--work-in-progress-)

[![Latest Version on Packagist](https://camo.githubusercontent.com/11596c8ad018b6639ca6dc41cf54d20d1cbf2063b234a20d1a1ca2594296ec66/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f70656e706573612f706573612e7376673f7374796c653d666c61742d737175617265263f696e636c7564655f70726572656c6561736573)](https://packagist.org/packages/openpesa/pesa)[![Test](https://github.com/openpesa/php-pesa/workflows/Test/badge.svg)](https://github.com/openpesa/php-pesa/workflows/Test/badge.svg)[![documentation](https://github.com/openpesa/php-pesa/workflows/documentation/badge.svg)](https://github.com/openpesa/php-pesa/workflows/documentation/badge.svg)[![Hits](https://camo.githubusercontent.com/ad9eefb64cbf9df4364cb1d580dc253e6bd04765f8fc13ec14eaea81ebc367ef/68747470733a2f2f686974732e736565796f756661726d2e636f6d2f6170692f636f756e742f696e63722f62616467652e7376673f75726c3d68747470732533412532462532466769746875622e636f6d2532466f70656e706573612532467068702d7065736126636f756e745f62673d253233373943383344267469746c655f62673d2532333535353535352669636f6e3d636f646569676e697465722e7376672669636f6e5f636f6c6f723d253233453745374537267469746c653d6869747326656467655f666c61743d74727565)](https://hits.seeyoufarm.com)[![codecov.io](https://camo.githubusercontent.com/5f6d681416b6c6acb60e199c6e59fcb899eed6aa87d0e54ee6151c373c89244b/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6f70656e706573612f7068702d706573612f6d61696e3f7374796c653d666c61742d737175617265)](https://codecov.io/github/openpesa/php-pesa)[![Total Downloads](https://camo.githubusercontent.com/c69d7e3fc17e377e9b1b1f4e66953b39daeb7aaa49b4a3549855a3ad42743245/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f70656e706573612f706573612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/openpesa/pesa)

The **Pesa SDK for PHP** makes it easy for developers to access [OpenAPI](https://openapiportal.m-pesa.com/) in their PHP code, and build robust applications and software using services like Customber 2 Bussiness, Query etc.

Documentation
-------------

[](#documentation)

Take a look at the [API docs here](https://openpesa.github.io/php-pesa/).

Getting Started
---------------

[](#getting-started)

1. **Sign up for OpenAPI Portal** – Before you begin, you need to sign up for an account and retrieve your credentials.
2. **Minimum requirements** – To run the SDK, your system will need to meet the [minimum requirements](https://openpesa.github.io/php-pesa/guide/installation#system-requirements), including having **PHP &gt;= 7.1**.
3. **Install the SDK** – Using \[Composer\] is the recommended way to install the Pesa SDK for PHP. The SDK is available via \[Packagist\] under the [`openpesa/php-pesa`](https://packagist.org/packages/openpesa/pesa) package. If Composer is installed globally on your system, you can run the following in the base directory of your project to add the SDK as a dependency:

    ```
    composer require openpesa/pesa
    ```

    Please see the [Installation section of the User Guide](https://openpesa.github.io/php-pesa/guide/installation) for more detailed information about installing the SDK through Composer and other means.
4. **Using the SDK** – The best way to become familiar with how to use the SDK is to read the [User Guide](https://openpesa.github.io/php-pesa/guide/quick_guide).

Usage
-----

[](#usage)

### Quick Examples

[](#quick-examples)

```
require 'vendor/autoload.php';

use Openpesa\SDK\Pesa;

// Intiate with credentials
$pesa = new Pesa([
            'api_key' => 'YOUR_API_KEY',
            'public_key' => 'PUBLIC_KEY',
            'client_options' => [],
        ],'sandbox');

// Setup the transaction
$data = [
    'input_Amount' => '10000',
    'input_Country' => 'TZN',
    'input_Currency' => 'TZS',
    'input_CustomerMSISDN' => '255766303775',
    'input_ServiceProviderCode' => '000000',
    'input_ThirdPartyConversationID' => 'rerekf',
    'input_TransactionReference' => rand(),
    'input_PurchasedItemsDesc' => 'Test Two Item'
];

// Execute
$result = $pesa->c2b($data);

// Print results
var_dump($result);
```

For more example check [pesa-demo-example](https://github.com/openpesa/php-pesa/tree/develop/examples).

### Testing

[](#testing)

```
composer test
```

Opening Issues
--------------

[](#opening-issues)

If you have a feature requrest or you encounter a bug, please file an issue on [our issue tracker on GitHub](https://github.com/openpesa/php-pesa/issues).

Resources
---------

[](#resources)

- [User Guide](https://openpesa.github.io/php-pesa/) – For both getting started and in-depth SDK usage information
- [API Docs](https://openapiportal.m-pesa.com/) – For details about operations, parameters, and responses
- [Blog](https://openpesa.github.io/blog/) – Tips &amp; tricks, articles, and announcements
- [Sample Project](https://github.com/alphaolomi/laravel-pesa-demo) - A quick, sample project to help get you started
- [Issues](https://github.com/openpesa/php-pesa/issues) – Report issues, submit pull requests, and get involved
- [@openpesa](https://twitter.com/openpesa) – Follow us on Twitter

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please review our [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

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

Credits
-------

[](#credits)

- [Alpha Olomi](https://github.com/openpesa)
- [Ley](https://github.com/leyluj)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~77 days

Recently: every ~70 days

Total

11

Last Release

1272d ago

Major Versions

v0.1.0 → 2.x-dev2022-11-23

PHP version history (4 changes)0.0.1PHP ^7.1

v0.0.4PHP ^7.1|^8.0

v0.0.6PHP ^7.2|^8.0

2.x-devPHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7534dd7341d883267be41935354b56c27f94d6bbd6a7abd9f257bb2d494a3798?d=identicon)[alphao](/maintainers/alphao)

---

Top Contributors

[![alphaolomi](https://avatars.githubusercontent.com/u/10551599?v=4)](https://github.com/alphaolomi "alphaolomi (74 commits)")[![leyluj](https://avatars.githubusercontent.com/u/5972918?v=4)](https://github.com/leyluj "leyluj (9 commits)")[![pro-cms](https://avatars.githubusercontent.com/u/57701433?v=4)](https://github.com/pro-cms "pro-cms (3 commits)")

---

Tags

hackertoberfesthacktoberfestmpesampesa-apimpesa-paymentsmpesa-sdkopenapipesa-sdkphptanzaniaapimobile-moneytanzaniapesaopenpesapesa-sdkpesa-sdk-php

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/openpesa-pesa/health.svg)

```
[![Health](https://phpackages.com/badges/openpesa-pesa/health.svg)](https://phpackages.com/packages/openpesa-pesa)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[samerior/mobile-money

Mobile payments API - Kenya

252.3k](/packages/samerior-mobile-money)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
