PHP code example of bluebillywig / bb-sapi-php-sdk

1. Go to this page and download the library: Download bluebillywig/bb-sapi-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/ */

    

bluebillywig / bb-sapi-php-sdk example snippets




use BlueBillywig\Sdk;
use GuzzleHttp\Promise\Coroutine;

$publication = "my-publication"; // The publication name (https://<publication name>.bbvms.com) in which the account and API key were created.
$tokenId = 1; // The ID of the generated API key.
$sharedSecret = "my-shared-secret"; // The randomly generated shared secret.

$sdk = Sdk::withRPCTokenAuthentication($publication, $tokenId, $sharedSecret);

$mediaClipPath = "/path/to/a/mediaclip.mp4";

// Asynchronous
$promise = Coroutine::of(function () use ($sdk) {
    $response = (yield $sdk->mediaclip->initializeUploadAsync($mediaClipPath));
    $response->assertIsOk();

    yield $sdk->mediaclip->helper->executeUploadAsync($mediaClipPath, $response->getDecodedBody());
});
$promise->wait();

// Synchronous
$response = $sdk->mediaclip->initializeUpload($mediaClipPath);
$response->assertIsOk();

$sdk->mediaclip->helper->executeUpload($mediaClipPath, $response->getDecodedBody());