PHPackages                             kangopenbanking/sdk - 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. kangopenbanking/sdk

ActiveLibrary[API Development](/categories/api)

kangopenbanking/sdk
===================

Kang Open Banking SDK

v1.1.2(3mo ago)01MITShell

Since Apr 11Pushed 3w agoCompare

[ Source](https://github.com/kangopenbanking/sdk)[ Packagist](https://packagist.org/packages/kangopenbanking/sdk)[ RSS](/packages/kangopenbanking-sdk/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)DependenciesVersions (5)Used By (0)

kangopenbanking/sdk
===================

[](#kangopenbankingsdk)

Official PHP SDK for the **Kang Open Banking (KOB) API** with first-class Laravel support.

- Packagist:
- API docs:
- OpenAPI spec:
- Sandbox spec:
- Status:

Requirements
------------

[](#requirements)

- PHP 8.1+
- Guzzle 7+

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

[](#installation)

```
composer require kangopenbanking/sdk
```

### Laravel auto-discovery

[](#laravel-auto-discovery)

The service provider and facade are auto-discovered. Publish the config with:

```
php artisan vendor:publish --tag=kob-config
```

Then set in `.env`:

```
KOB_CLIENT_ID=your_client_id
KOB_CLIENT_SECRET=your_client_secret      # required for client_credentials
KOB_API_KEY=sbx_your_sandbox_key          # optional sandbox shortcut
KOB_ENVIRONMENT=sandbox                    # sandbox | production
```

Authentication
--------------

[](#authentication)

The Kang Open Banking platform uses **OAuth 2.0** for production-track (`ga`) endpoints, matching what is documented at :

FlowWhen to use`client_credentials`Server-to-server (your backend â†” KOB)`authorization_code` + **PKCE** (S256)End-user delegated access (AISP / PISP)Sandbox API key (`sbx_â€¦`) via `X-API-Key`Quick sandbox testing only â€” never in prod### Server-to-server (`client_credentials`)

[](#server-to-server-client_credentials)

The SDK handles the token request, caching, and refresh for you when a `client_secret` is provided:

```
use KangOpenBanking\KangOpenBanking;

$kob = new KangOpenBanking([
    'client_id'     => getenv('KOB_CLIENT_ID'),
    'client_secret' => getenv('KOB_CLIENT_SECRET'),
    'environment'   => 'production',
]);

// First API call triggers a token fetch + cache automatically.
$accounts = $kob->accounts->list();
```

You can also fetch a token explicitly:

```
$token = $kob->getToken([
    'grant_type' => 'client_credentials',
    'scope'      => 'accounts payments',
]);
```

### Authorization Code + PKCE (user-delegated)

[](#authorization-code--pkce-user-delegated)

The SDK helps you build the authorization URL and exchange the returned code for a token. **PKCE verifier/challenge generation and storage are your application's responsibility** â€” generate them with your framework and persist them alongside the user's session.

```
// 1. Generate PKCE in your app (example helper):
$verifier  = rtrim(strtr(base64_encode(random_bytes(64)), '+/', '-_'), '=');
$challenge = rtrim(strtr(base64_encode(hash('sha256', $verifier, true)), '+/', '-_'), '=');

// 2. Build the authorization URL and redirect the user.
$authUrl = $kob->buildAuthorizationUrl([
    'redirect_uri'          => 'https://yourapp.com/callback',
    'scope'                 => 'openid accounts payments',
    'state'                 => $state,
    'code_challenge'        => $challenge,
    'code_challenge_method' => 'S256',
]);

// 3. On callback, exchange the code for an access token.
$token = $kob->getToken([
    'grant_type'    => 'authorization_code',
    'code'          => $_GET['code'],
    'redirect_uri'  => 'https://yourapp.com/callback',
    'code_verifier' => $verifier,
]);

$kob->setAccessToken($token['access_token'], $token['expires_in']);
```

The SDK does **not** persist tokens for you. Store them in your session, cache, or database according to your security model.

### Sandbox API key

[](#sandbox-api-key)

For quick sandbox testing, you can skip OAuth entirely by passing an `sbx_â€¦` key. The SDK will send it as `X-API-Key`:

```
$kob = new KangOpenBanking([
    'client_id'   => 'your_client_id',
    'api_key'     => 'sbx_your_sandbox_key',
    'environment' => 'sandbox',
]);
```

Quick start
-----------

[](#quick-start)

```
use KangOpenBanking\KangOpenBanking;

$kob = new KangOpenBanking([
    'client_id'     => getenv('KOB_CLIENT_ID'),
    'client_secret' => getenv('KOB_CLIENT_SECRET'),
    'environment'   => 'sandbox',
]);

// AISP â€” list a user's accounts
$accounts = $kob->accounts->list();

// Gateway â€” create a Mobile Money charge
$charge = $kob->charges->create([
    'merchant_id'    => 'mch_uuid',
    'amount'         => 5000,
    'currency'       => 'XAF',
    'channel'        => 'mobile_money',
    'customer_phone' => '237677123456',
    'tx_ref'         => 'order_001',
]);

// Verify the charge status
$verified = $kob->charges->verify($charge['id']);
```

Available resources
-------------------

[](#available-resources)

These match the public methods exposed by `KangOpenBanking\KangOpenBanking`(see `src/KangOpenBanking.php`):

PropertyClass`$kob->accounts``AccountsResource``$kob->balances``BalancesResource``$kob->transactions``TransactionsResource``$kob->beneficiaries``BeneficiariesResource``$kob->charges``ChargesResource``$kob->refunds``RefundsResource``$kob->payouts``PayoutsResource``$kob->gateway``GatewayResource``$kob->sandbox``SandboxResource``$kob->webhooks``WebhooksResource``$kob->payByBank``PayByBankResource``$kob->globalAccounts``GlobalAccountsResource`Webhook verification
--------------------

[](#webhook-verification)

```
use KangOpenBanking\KangOpenBanking;

$isValid = KangOpenBanking::verifyWebhookSignature(
    $rawBody,
    $signatureHeader,
    getenv('KOB_WEBHOOK_SECRET')
);
```

### Laravel middleware

[](#laravel-middleware)

```
use KangOpenBanking\Laravel\Middleware\VerifyWebhookSignature;

Route::post('/webhooks/kob', [WebhookController::class, 'handle'])
    ->middleware(VerifyWebhookSignature::class);
```

Error handling
--------------

[](#error-handling)

```
use KangOpenBanking\Exceptions\KOBException;

try {
    $charge = $kob->charges->create([ /* â€¦ */ ]);
} catch (KOBException $e) {
    // $e->getMessage(), $e->statusCode, $e->errorCode, $e->errorId
}
```

Rate limits
-----------

[](#rate-limits)

Endpoint groupLimitToken endpoint100 / hour per clientAISP endpoints1,000 / hour per consentPISP endpoints500 / hour per clientGateway endpoints1,000 / hour per merchantHTTP 429 responses include a `Retry-After` header.

Other language SDKs
-------------------

[](#other-language-sdks)

Each SDK is versioned and released independently. Check each package page for its current status and version before depending on it:

- Node.js â€”
- Python â€”
- PHP (this package) â€”

Support
-------

[](#support)

- Email:
- Docs:

License
-------

[](#license)

MIT

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance88

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

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.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

104d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/113870805?v=4)[kangob](/maintainers/kangob)[@kangob](https://github.com/kangob)

---

Top Contributors

[![kangopenbanking](https://avatars.githubusercontent.com/u/238778527?v=4)](https://github.com/kangopenbanking "kangopenbanking (22 commits)")

### Embed Badge

![Health badge](/badges/kangopenbanking-sdk/health.svg)

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k18](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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