# 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.

<pre class="language-php"><code class="lang-php"><strong>&#x3C;?php
</strong><strong>
</strong><strong>use Otnansirk\SnapBI\Services\Config
</strong><strong>...
</strong>
Config::bca([
    "client_id"       => "a82s28bf-493a-4183-ba01-08129dd08432",
    "client_secret"   => "91424666-848d-40fb-8da3-c796eqdfa057",
    "ssh_private_key" => &#x3C;&#x3C;&#x3C;SSHKEY
                        -----BEGIN PRIVATE KEY-----
                        MIIBIjANBgkqhkiG9w0B...
                        -----END PRIVATE KEY-----
                        SSHKEY,
    "ssh_public_key"  => &#x3C;&#x3C;&#x3C;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",
]);
</code></pre>

{% hint style="warning" %}
This configuration value is for example only.
{% endhint %}

### Default Config Values

<table><thead><tr><th width="359">Key</th><th>Required</th></tr></thead><tbody><tr><td>client_id</td><td>Yes</td></tr><tr><td>client_secret</td><td>Yes</td></tr><tr><td>ssh_private_key</td><td>Yes</td></tr><tr><td>ssh_public_key</td><td>Yes</td></tr><tr><td>partner_id</td><td>Yes</td></tr><tr><td>account_id</td><td>Yes</td></tr><tr><td>bank_card_token</td><td>Yes</td></tr><tr><td>channel_id</td><td>Yes</td></tr><tr><td>base_url</td><td>Yes</td></tr></tbody></table>

### 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.&#x20;

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

{% hint style="warning" %}
This configuration value is for example only.
{% endhint %}

### Method Support

<table><thead><tr><th width="272.3333333333333">Method</th><th width="119">Return</th><th>Description</th></tr></thead><tbody><tr><td>for("key")</td><td>static</td><td>Tells the config to be set. "key" is the supported methods located on <a href="broken-reference">Bank Support</a></td></tr><tr><td>register([config_values])</td><td>void</td><td>Register <a href="#config-values">config values</a></td></tr><tr><td>get("key")</td><td>string</td><td>Get config value by key. "key" is the supported key located on <a href="#config-values">Config Values</a></td></tr><tr><td>all()</td><td>array</td><td>Get all config values</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://php-snap-bi.gitbook.io/docs/getting-started/configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
