Configuration

Introduction

All of configuration you can register with class Otnansirk\SnapBI\Services\Config

Register Config

Before using php-snap-bi you must register all the necessary configurations.

<?php

use Otnansirk\SnapBI\Services\Config
...

Config::bca([
    "client_id"       => "a82s28bf-493a-4183-ba01-08129dd08432",
    "client_secret"   => "91424666-848d-40fb-8da3-c796eqdfa057",
    "ssh_private_key" => <<<SSHKEY
                        -----BEGIN PRIVATE KEY-----
                        MIIBIjANBgkqhkiG9w0B...
                        -----END PRIVATE KEY-----
                        SSHKEY,
    "ssh_public_key"  => <<<SSHKEY
                        -----BEGIN PUBLIC KEY-----
                        IIBCgKCAQEAw8VfUgnj3yc2GTgDtY...
                        -----END PUBLIC KEY-----
                        SSHKEY,
    "partner_id"      => "UATCORP001",
    "account_id"      => "0433tt5827",
    "bank_card_token" => "123dde37890",
    "channel_id"      => "1111",
    "base_url"        => "https://domainapi.klikbca.com",
]);

Default Config Values

Key
Required

client_id

Yes

client_secret

Yes

ssh_private_key

Yes

ssh_public_key

Yes

partner_id

Yes

account_id

Yes

bank_card_token

Yes

channel_id

Yes

base_url

Yes

Chaining Support

The Config class offers the convenience of query chaining, allowing you to perform multiple operations without having to call them directly through methods.

To achieve this, you can utilize the "for" method provided by the Config class. Rather than invoking Config::bca([...]), you can adopt a more structured approach by using Config::for("bca")->register([...]).

<?php

use Otnansirk\SnapBI\Services\Config
...

Config::for("bca")->register([
    "client_id"       => "a82s28bf-493a-4183-ba01-08129dd08432",
    "client_secret"   => "91424666-848d-40fb-8da3-c796eqdfa057",
    "ssh_private_key" => <<<SSHKEY
                        -----BEGIN PRIVATE KEY-----
                        MIIBIjANBgkqhkiG9w0B...
                        -----END PRIVATE KEY-----
                        SSHKEY,
    "ssh_public_key"  => <<<SSHKEY
                        -----BEGIN PUBLIC KEY-----
                        IIBCgKCAQEAw8VfUgnj3yc2GTgDtY...
                        -----END PUBLIC KEY-----
                        SSHKEY,
    "partner_id"      => "UATCORP001",
    "account_id"      => "0433tt5827",
    "bank_card_token" => "123dde37890",
    "channel_id"      => "1111",
    "base_url"        => "https://domainapi.klikbca.com",
]);

Method Support

Method
Return
Description

for("key")

static

Tells the config to be set. "key" is the supported methods located on Bank Support

register([config_values])

void

Register config values

get("key")

string

Get config value by key. "key" is the supported key located on Config Values

all()

array

Get all config values

Last updated