PHP code example of blockadelabs / sdk
1. Go to this page and download the library: Download blockadelabs/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/ */
blockadelabs / sdk example snippets
use BlockadeLabs\SDK\Facades\BlockadeLabsClient;
$skyboxStyles = BlockadeLabsClient::getSkyboxStyles();
$skybox = BlockadeLabsClient::generateSkybox([
'prompt' => 'PROMPT_GOES_HERE', // Required
'skybox_style_id' => '2', // Required,
'remix_imagine_id' => 1, // OR remix_obfuscated_id / Optional
'webhook_url' => 'YOUR_WEBHOOK_URL', // Optional
]);
$generators = BlockadeLabsClient::getGenerators();
$generateImagine = BlockadeLabsClient::generateImagine([
'generator' => 'stable-skybox', // REQUIRED
'prompt' => 'PROMPT_GOES_HERE', // REQUIRED
'init_image' => $request->file('init_image') // example for the init_image file param
...other_generator_data_params, // Optional
'webhook_url' => 'YOUR_WEBHOOK_URL', // Optional
]);
'init_image' => $request->file('init_image'),
$generateImagine = BlockadeLabsClient::generateImagine([
'generator' => 'stable-skybox',
'prompt' => 'some prompt',
]);
$imagine = BlockadeLabsClient::getImagineById($generateImagine['request']['id']);
$generateImagine = BlockadeLabsClient::generateImagine([
'generator' => 'stable-skybox',
'prompt' => 'some prompt',
]);
$imagine = BlockadeLabsClient::getImagineByObfuscatedId($generateImagine['request']['obfuscated_id']);
$myImagines = BlockadeLabsClient::getImagineHistory([
'status' => 'IMAGINE_STATUS', // OPTIONAL
'limit' => 10, // OPTIONAL
'offset' => 0, // OPTIONAL
'order' => 'ASC', // OPTIONAL
'imagine_id' => 1, // OPTIONAL
'query' => 'PROMPT', // OPTIONAL
'generator' => 'GENERATOR', // OPTIONAL
]);
$generateImagine = BlockadeLabsClient::generateImagine([
'generator' => 'stable-skybox',
'prompt' => 'some prompt',
]);
$result = BlockadeLabsClient::cancelImagine($generateImagine['request']['id']);
$result = BlockadeLabsClient::cancelAllPendingImagines();
$generateImagine = BlockadeLabsClient::generateImagine([
'generator' => 'stable-skybox',
'prompt' => 'some prompt',
]);
$result = BlockadeLabsClient::deleteImagine($generateImagine['request']['id']);