PHP code example of sdksio / apimatic-ak-sdk

1. Go to this page and download the library: Download sdksio/apimatic-ak-sdk 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/ */

    

sdksio / apimatic-ak-sdk example snippets


use AkoyaLib\Logging\LoggingConfigurationBuilder;
use AkoyaLib\Logging\RequestLoggingConfigurationBuilder;
use AkoyaLib\Logging\ResponseLoggingConfigurationBuilder;
use Psr\Log\LogLevel;
use AkoyaLib\Environment;
use AkoyaLib\Authentication\BasicAuthCredentialsBuilder;
use AkoyaLib\Authentication\BearerAuthCredentialsBuilder;
use AkoyaLib\AkoyaClientBuilder;

$client = AkoyaClientBuilder::init()
    ->basicAuthCredentials(
        BasicAuthCredentialsBuilder::init(
            'Username',
            'Password'
        )
    )
    ->bearerAuthCredentials(
        BearerAuthCredentialsBuilder::init(
            'AccessToken'
        )
    )
    ->environment(Environment::PRODUCTION)
    ->loggingConfiguration(
        LoggingConfigurationBuilder::init()
            ->level(LogLevel::INFO)
            ->requestConfiguration(RequestLoggingConfigurationBuilder::init()->body(true))
            ->responseConfiguration(ResponseLoggingConfigurationBuilder::init()->headers(true))
    )
    ->build();