PHP code example of dokobit / gateway-php-sdk

1. Go to this page and download the library: Download dokobit/gateway-php-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/ */

    

dokobit / gateway-php-sdk example snippets


    use Dokobit\Gateway\Client;

    // <...>
    $client = Client::create([
        'apiKey' => 'xxxxxx',
        'sandbox' => true,
    ]);
    

    use Dokobit\Gateway\Client;
    use Monolog\Handler\StreamHandler;
    use Monolog\Logger;

    // <...>
    $log = new Logger('requests');
    $log->pushHandler(new StreamHandler(__DIR__ . '/path/to/info.log', Logger::INFO));

    $client = Client::create([
        'apiKey' => 'xxxxxx',
        'sandbox' => true,
    ], $log);
    

    use Dokobit\Gateway\Query\File\Upload;

    // <...>
    $request = new Upload('/path/to/your/document.pdf');
    $result = $client->get($request);
    echo $result->getStatus(); // Request status
    echo $result->getToken(); // Uploaded file token
    

$client->downloadFile($signedFileUrl, $downloadedFilePath);

$client->downloadFile($signedFileUrl, $downloadedFilePath, false);