PHPackages                             floodx92/kh-gateway - 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. floodx92/kh-gateway

ActiveLibrary

floodx92/kh-gateway
===================

v1.0.0(1y ago)111MITPHPPHP &gt;=8.1

Since May 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/floodx92/kh-gateway)[ Packagist](https://packagist.org/packages/floodx92/kh-gateway)[ RSS](/packages/floodx92-kh-gateway/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

KhGateway
=========

[](#khgateway)

This package provides a simple way to interact with the K&amp;H Bank Gateway API. This package is not affiliated with K&amp;H Bank in any way.

Use the official docs to understand the full payment flow: [K&amp;H Official documentation](https://github.com/khpos/Payment-gateway_HU/wiki)

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

[](#requirements)

- PHP 8.1 or higher

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

[](#installation)

You can install the package via composer:

```
composer require floodx92/kh-gateway
```

Usage
-----

[](#usage)

First, you need to instantiate `CurlHttpClient` and `OpenSSLAdapter` classes. You can always use `new ClassName()` or `ClassName::make()` to instantiate a class.

```
use Floodx92\KhGateway\Util\CurlHttpClient;
use Floodx92\KhGateway\Crypto\OpenSSLAdapter;
use Floodx92\KhGateway\ApiService;
use Floodx92\KhGateway\Storage\FileKeyStorage;

// Instantiate the Http client, with the API URL
$client = CurlHttpClient::make(ApiService::SANDBOX_URL);
//client = CurlHttpClient::make(ApiService::PRODUCTION_URL);

// For the OpenSSLAdapter, first we need a KeyStore
$keyStore = FileKeyStorage::make(
    'path/to/your/private.key',
    'path/to/your/public.key',
    //optionally you can pass a passphrase as last argument
)
$adapter = OpenSSLAdapter::make($keyStore, $verifySignature = true);
```

Then, you can use the `ApiService` class to send requests to the API.

```
use Floodx92\KhGateway\ApiService;
use Floodx92\KhGateway\Model\Request\EchoRequest;
use Floodx92\KhGateway\Exception\HttpException;

$api = ApiService::make($adapter, $client);

// Send an Echo request
$echoRequest = EchoRequest::make($merchantId = 'ABC123456')
try {
    $echoResult = $api->echo($echoRequest);
    echo $echoResult->resultCode;
} catch (HttpException $e) {
    // Handle the exception
}
```

Error Handling
--------------

[](#error-handling)

All methods can throw a `HttpException` in case of a cURL error or when an HTTP error status code is received. You should catch this exception and handle it appropriately in your code.

TODO
----

[](#todo)

- Add tests
- Add more documentation
- Better JSON mapping for the responses

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

724d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/06223548083051afe845f9a7dc2359fd0024bb91a265db9901c624a706bdd6d0?d=identicon)[floodx92](/maintainers/floodx92)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/floodx92-kh-gateway/health.svg)

```
[![Health](https://phpackages.com/badges/floodx92-kh-gateway/health.svg)](https://phpackages.com/packages/floodx92-kh-gateway)
```

PHPackages © 2026

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