PHP code example of mediamaskio / mediamask-php

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

    

mediamaskio / mediamask-php example snippets





 Configure Bearer authorization: bearerAuth
$config = Mediamask\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Mediamask\Api\MediamaskApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

// \OpenAPI\Client\Model\NewImage | Provide the template and placeholders values that should be rendered in the image
$new_image = {
    "template":"3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "placeholders": [
        {
            "name":"text placeholder name",
            "text":"an example text"
        },
        {
            "name":"image placeholder name",
            "image":"https://example.com/example.jpg"
            }
        ]
    }; 
try {
    $result = $apiInstance->renderImage($new_image);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling MediamaskApi->renderImage: ', $e->getMessage(), PHP_EOL;
}