PHPackages                             kanekescom/bkn-api-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. [Framework](/categories/framework)
4. /
5. kanekescom/bkn-api-gateway

ActiveProject[Framework](/categories/framework)

kanekescom/bkn-api-gateway
==========================

BKN Web Service API Gateway

v1.0.1(2mo ago)2727MITPHPPHP ^7.3|^8.0

Since Apr 24Pushed 2mo agoCompare

[ Source](https://github.com/kanekescom/bkn-api-gateway)[ Packagist](https://packagist.org/packages/kanekescom/bkn-api-gateway)[ Fund](https://s.id/hadibmac)[ GitHub Sponsors](https://github.com/sponsors/achmadhadikurnia)[ RSS](/packages/kanekescom-bkn-api-gateway/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

BKN Web Service API Gateway
===========================

[](#bkn-web-service-api-gateway)

Server-side proxy untuk mengakses BKN Web Service API (`apimws.bkn.go.id`). Gateway ini di-deploy di server yang IP-nya sudah di-whitelist oleh BKN, sehingga aplikasi lokal bisa mengkonsumsi API BKN melalui proxy ini.

Arsitektur
----------

[](#arsitektur)

Gateway ini didesain sebagai **Proxy**.

Aplikasi lokal (SIMPEG) bertugas me-request token APIM &amp; SSO ke BKN, lalu menyertakannya di HTTP Header saat mengakses Gateway. Gateway akan meneruskan request &amp; header tersebut secara utuh ke API REST BKN.

```
┌──────────────┐          ┌────────────────────┐          ┌──────────────────────┐
│  Aplikasi    │          │  BKN Gateway       │          │  BKN Web Service API │
│  Lokal       │────────▶│  (Lumen Proxy)     │────────▶ │  apimws.bkn.go.id    │
│  (SIMPEG)    │          │                    │          │  :8243               │
│              │◀────────│                    │◀──────── │                      │
└──────────────┘          └────────────────────┘          └──────────────────────┘
   HTTP Request             Forward Request                   Response
   + X-Api-Key              + Forward All Headers
   + Authorization
   + Auth

```

Fitur
-----

[](#fitur)

- **Proxy** — Meneruskan semua HTTP method (GET, POST, PUT, PATCH, DELETE) beserta seluruh Header bawaan client.
- **Sangat Ringan** — Berjalan secara *stateless*.
- **File upload** — Support multipart/form-data untuk upload file.
- **API key protection** — Proxy dilindungi dengan API key `X-Api-Key`.

Persyaratan
-----------

[](#persyaratan)

- PHP &gt;= 7.3
- Composer
- Server dengan IP yang di-whitelist oleh BKN

Instalasi
---------

[](#instalasi)

1. Clone repository:

```
git clone https://github.com/kanekescom/bkn-api-gateway.git
cd bkn-api-gateway
```

2. Install dependencies:

```
composer install
```

3. Salin file environment:

```
cp .env.example .env
```

4. Konfigurasi `.env`:

```
APP_NAME="BKN Web Service API Gateway"
APP_URL=https://your-gateway-domain.com

# API Key untuk proteksi gateway (buat sendiri, misal random string)
GATEWAY_API_KEY=your-secret-api-key
```

> **Catatan:** Ganti `your-gateway-domain.com` dengan domain atau IP server Anda yang sudah di-whitelist oleh BKN.

Konfigurasi
-----------

[](#konfigurasi)

VariabelDeskripsiDefault`GATEWAY_API_KEY`Secret key untuk melindungi proxy(wajib diisi)`SIASN_WS_URL`Base URL BKN Web Service API (host + port)`https://apimws.bkn.go.id:8243``SIASN_TIMEOUT`Request timeout (detik)`60``SIASN_VERIFY_SSL`Verifikasi SSL`true`Endpoint
--------

[](#endpoint)

### Health Check

[](#health-check)

```
GET /

```

Response:

```
{
  "name": "BKN Web Service API Gateway",
  "status": "running"
}
```

### Proxy SIASN API

[](#proxy-siasn-api)

```
ANY /api/{path}

```

Path setelah `/api/` akan diteruskan langsung ke `SIASN_WS_URL` dan Gateway mendukung semua endpoint SIASN API.

Header wajib untuk dikirim oleh Client:

- `X-Api-Key`: Secret API Key Gateway Anda.
- `Authorization`: `Bearer ` (Token APIM BKN).
- `Auth`: `bearer ` (Token SSO BKN).
- Header opsional lainnya (misal: `Content-Type: application/json`).

Gateway akan meneruskan (*forward*) semua header di atas (kecuali `X-Api-Key` dan header internal) secara utuh ke BKN.

Contoh Penggunaan
-----------------

[](#contoh-penggunaan)

> **Catatan:** Ganti `https://your-gateway-domain.com` di bawah ini dengan URL gateway Anda yang sebenarnya.

### cURL

[](#curl)

```
# GET - Data Utama PNS (SIASN API)
curl -H "X-Api-Key: your-secret-api-key" \
  -H "Authorization: Bearer my_apim_token" \
  -H "Auth: bearer my_sso_token" \
  https://your-gateway-domain.com/api/apisiasn/1.0/pns/data-utama/123456789012345678

# GET - Referensi Agama (Referensi API)
curl -H "X-Api-Key: your-secret-api-key" \
  -H "Authorization: Bearer my_apim_token" \
  -H "Auth: bearer my_sso_token" \
  https://your-gateway-domain.com/api/referensi_siasn/1/agama

# POST - Photo PNS (SIASN API)
curl -X POST \
  -H "X-Api-Key: your-secret-api-key" \
  -H "Authorization: Bearer my_apim_token" \
  -H "Auth: bearer my_sso_token" \
  -H "Content-Type: application/json" \
  -d '{"nip":"123456789012345678"}' \
  https://your-gateway-domain.com/api/apisiasn/1.0/pns/photo
```

### Integrasi di Aplikasi Laravel (Client)

[](#integrasi-di-aplikasi-laravel-client)

Aplikasi client (misal: SIMPEG) yang memanggil layanan Gateway:

```
use Illuminate\Support\Facades\Http;

// Buat HTTP client ke Gateway
$gateway = Http::baseUrl('https://your-gateway-domain.com/api')
    ->withHeaders([
        'X-Api-Key'     => 'your-secret-api-key',
        'Authorization' => 'Bearer ' . $apimToken,
        'Auth'          => 'bearer ' . $ssoToken,
    ]);

// SIASN API
$response = $gateway->get("/apisiasn/1.0/pns/data-utama/{$nip}");
$dataUtama = $response->json();

// Referensi API
$response = $gateway->get("/referensi_siasn/1/ref-unor");
$referensi = $response->json();
```

Mapping Path
------------

[](#mapping-path)

Path setelah `/api/` diteruskan apa adanya ke SIASN API:

BKN API AsliVia Gateway`apimws.bkn.go.id:8243/apisiasn/1.0/pns/data-utama/{nip}``your-gateway-domain.com/api/apisiasn/1.0/pns/data-utama/{nip}``apimws.bkn.go.id:8243/apisiasn/1.0/pns/photo``your-gateway-domain.com/api/apisiasn/1.0/pns/photo``apimws.bkn.go.id:8243/referensi_siasn/1/ref-unor``your-gateway-domain.com/api/referensi_siasn/1/ref-unor`Struktur Project
----------------

[](#struktur-project)

```
/
├── app/
│   ├── Http/
│   │   ├── Controllers/
│   │   │   └── ProxyController.php    # Catch-all proxy controller (Forwarder)
│   │   └── Middleware/
│   │       └── ApiKeyMiddleware.php   # API key authentication untuk Gateway
├── config/
│   └── gateway.php                    # Konfigurasi mode dan rahasia Gateway
├── routes/
│   └── web.php                        # Route definitions
├── .env.example
├── composer.json
└── README.md

```

Troubleshooting
---------------

[](#troubleshooting)

ErrorPenyebabSolusi`401 Unauthorized` (dari Gateway)API key salah/tidak adaCek `X-Api-Key` header dan `GATEWAY_API_KEY` di `.env``401 Unauthorized` (dari BKN)Token kedaluwarsa / salahPastikan client men-generate dan mengirim token `Authorization` dan `Auth` yang valid`502 Gateway Error`Gagal koneksi ke BKN Web Service APICek koneksi server dan pastikan IP server Gateway sudah di-whitelist BKNLicense
-------

[](#license)

MIT

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance87

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity40

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

Every ~27 days

Total

2

Last Release

64d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/61120fbce750b7e0faa02a57002c4f0a0b378efc26b1b1f3bc19257f29e22fbe?d=identicon)[kanekescom](/maintainers/kanekescom)

---

Top Contributors

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

---

Tags

frameworklaravellumen

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kanekescom-bkn-api-gateway/health.svg)

```
[![Health](https://phpackages.com/badges/kanekescom-bkn-api-gateway/health.svg)](https://phpackages.com/packages/kanekescom-bkn-api-gateway)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.5k](/packages/laravel-framework)[bagisto/bagisto

Bagisto Laravel E-Commerce

27.6k172.1k9](/packages/bagisto-bagisto)[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k46](/packages/neuron-core-neuron-ai)[nutgram/nutgram

The Telegram bot library that doesn't drive you nuts

737290.3k8](/packages/nutgram-nutgram)[yorcreative/laravel-scrubber

A laravel package that scrubs sensitive information for you.

15782.6k2](/packages/yorcreative-laravel-scrubber)

PHPackages © 2026

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