PHPackages                             osenco/co-op - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. osenco/co-op

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

osenco/co-op
============

Intuitive PHP SDK for Co-operative Bank of Kenya. Just Plug 'N Play

97512PHP

Since Sep 5Pushed 6y ago4 watchersCompare

[ Source](https://github.com/osenco/co-op)[ Packagist](https://packagist.org/packages/osenco/co-op)[ RSS](/packages/osenco-co-op/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Co-operative Bank Kenya PHP SDK
===============================

[](#co-operative-bank-kenya-php-sdk)

Intuitive PHP SDK Co-operative Bank Kenya API

Pre-requisites
--------------

[](#pre-requisites)

### Create an application

[](#create-an-application)

Create or login to your account at

On the left panel, you can see a list of menus. Click on Applications to access the list of available applications in which case you can choose to use the default ones or create your own.

### Subscribe to API(s)

[](#subscribe-to-apis)

- Select the application or create your own application using steps described earlier.
- Click “Subscribe”. A pop up message appears as shown:

### Generate Keys

[](#generate-keys)

- Click on “Applications” on the left panel.
- Choose the application for which you want to generate keys
- Choose the appropriate environment from the tabs(production or sandbox ).
- Specify Callback URL and then click “Generate keys”. Leave other fields have default values;

Installation
------------

[](#installation)

Install via composer by typing in your terminal

```
composer require osenco/co-op
```

If you dont use composer you can just download this library from the releases, unzip it in your project and include the autoload.php file in your project.

```
require_once('path/to/autoload.php');
```

Setup
-----

[](#setup)

Use the `coopSetup` helper function to configure and instantiate our object

```
    $config = array(
        "env"                 => "sandbox",
        "consumerKey"         => "ss0sD2ANhjvhx_rHU0a6Xf8ROdYa",
        "consumerSecret"      => "zOfReXCIwn1TfnEYJJJGNP6l3Tka",
        "accountNumber"       => "54321987654321",
        "bankCode"            => "011",
        "branchCode"          => "00011001",
        "callbackURL"         => "/coop/callback",
        "transactionCurrency" => "KES",
    );
    coopSetup($config);
```

### Usage

[](#usage)

We recommend using the following helper functions

### Check Account Balance

[](#check-account-balance)

Account Balance Enquiry API will enable you to enquire about your own Co-operative Bank accounts' balance as at now for the specified account number

```
    $response = coopAccountBalance(
        $messageReference,
        $accountNumber = null,
        $callback = null
    );
```

### Check AccountTransactions

[](#check-accounttransactions)

Account Transactions Enquiry API will enable you to enquire about your own Co-operative Bank accounts' latest transactions for the specified account number and number of transactions to be returned

```
    $response = coopAccountTransactions(
        $messageReference,
        $accountNumber,
        $NoOfTransactions = '1',
        $callback = null
    );
```

### Get Exchange Rate

[](#get-exchange-rate)

Exchange Rate Enquiry API will enable you to enquire about the current SPOT exchange rate for the specified currencies

```
    $response = coopExchangeRate(
        $messageReference,
        $fromCurrencyCode = 'KES',
        $toCurrencyCode = 'USD',
        $callback = null
    );
```

### IFT Account To Account Transfer

[](#ift-account-to-account-transfer)

Internal Funds Transfer Account to Account API will enable you to transfer funds from your own Co-operative Bank account to other Co-operative Bank account(s)

```
    $response = coopIFTAccountToAccount(
        $messageReference,
        $accountNumber,
        $amount,
        $transactionCurrency = 'KES',
        $narration = 'Payment',
        $destinations = array(),
        $callback = null
    );
```

### PesaLink Send To Account

[](#pesalink-send-to-account)

PesaLink Send to Account Funds Transfer API will enable you to transfer funds from your own Co-operative Bank account to Bank account(s) in IPSL participating banks

```
    $response = coopPesaLinkSendToAccount(
        $messageReference,
        $accountNumber,
        $amount,
        $transactionCurrency = 'KES',
        $narration = 'Payment',
        $destinations = array(),
        $callback = null
    );
```

### Check Transaction Status

[](#check-transaction-status)

This is a Transaction Status Enquiry Request interface called by an API consumer to APIM to enquire the status of an earlier requested transaction.

```
    $response = coopTransactionStatus(
        $messageReference,
        $callback = null
    );
```

Callback functions
------------------

[](#callback-functions)

The last OPTIONAL argument in the functions above (`$callback`) allows you to add a callable function to process the API responses. You can either pass a defined function or a closure

### Using A Defined Function

[](#using-a-defined-function)

```
    function processCoopTransactionStatus($response) {
        // Do something with $response
    }
    $response = coopTransactionStatus($messageReference, 'processCoopTransactionStatus');
```

### Using A Closure

[](#using-a-closure)

```
    $response = coopTransactionStatus($messageReference, function ($response) {
        // Do something with $response
    });
```

Callback URL and Reconciling Data
---------------------------------

[](#callback-url-and-reconciling-data)

Use the `coopReconcile()` helper function at your callback URL endpoint to process responses from the API, optionally passing a callable function to process the API responses. You can either pass a defined function or a closure

### Using A Defined Function

[](#using-a-defined-function-1)

```
    function processCoopTransactionStatusResponse($response) {
        // Do something with $response
    }
    $response = coopReconcile('processCoopTransactionStatusResponse');
```

### Using A Closure

[](#using-a-closure-1)

```
    $response = coopReconcile(function ($response) {
        // Do something with $response
    });
```

Test Cases
----------

[](#test-cases)

As a developer, the test cases will be available to you for download as you are creating the sandbox app.

The test cases are in place to ensure that you have well understood the API structure for requests and responses for our different APIs. These test cases are in an excel spreadsheet that you should fill in with the results from each of the test scenarios that you want to consume.

As the Test cases will cover all the APIs available, you will only be required to carry out the test cases for the APIs you had initially selected.

Go - Live
---------

[](#go---live)

Once you have already tried out the APIs on our platform and have tested these against our test cases provided, you can make a formal request to go to production.

You will need to have the test cases duly filled, then send an email request, together with these filled in test cases, to our support team who will guide you on the next steps to enable you to get to production.

Send the email request and the test cases to

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1e4a04231f4571a99a35c6e8acb096b5cfd7a28eb73b71e026f2024f353fdaca?d=identicon)[maukoese](/maintainers/maukoese)

---

Top Contributors

[![maukoese](https://avatars.githubusercontent.com/u/14233942?v=4)](https://github.com/maukoese "maukoese (67 commits)")

---

Tags

bankcoopfinancefundskenyapesalinktransfers

### Embed Badge

![Health badge](/badges/osenco-co-op/health.svg)

```
[![Health](https://phpackages.com/badges/osenco-co-op/health.svg)](https://phpackages.com/packages/osenco-co-op)
```

PHPackages © 2026

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