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",
]);

This configuration value is for example only.

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",
]);

This configuration value is for example only.

Method Support

Method
Return
Description

for("key")

static

register([config_values])

void

get("key")

string

all()

array

Get all config values

Last updated