PHP code example of dtyq / sdk-base

1. Go to this page and download the library: Download dtyq/sdk-base library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dtyq / sdk-base example snippets


$sdkBase = new SdkBase($container, [
    'sdk_name' => 'example_sdk',
    'log_sanitizer' => [
        'enabled' => true,
        'mask' => '***',
        'mask_mode' => 'partial',
        'sensitive_headers' => ['x-business-secret'],
        'sensitive_fields' => ['mobile'],
        'filter' => static function (string $level, string $message, array $context): array {
            if ($message === 'client_request') {
                $context['options']['body'] = '[BUSINESS_REDACTED]';
                $context['content'] = '[RESPONSE_REDACTED]';
            }
            return $context;
        },
    ],
]);

[
    'log_sanitizer' => [
        'mask_mode' => 'partial',
        'mask' => '***',
        'visible_prefix_length' => 3,
        'visible_suffix_length' => 4,
    ],
]

[
    'log_sanitizer' => [
        'mask_mode' => 'full',
        'mask' => '[REDACTED]',
    ],
]

[
    'log_sanitizer' => [
        'enabled' => false,
    ],
]