PHP code example of runapi-ai / seedance

1. Go to this page and download the library: Download runapi-ai/seedance 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/ */

    

runapi-ai / seedance example snippets




unApi\Seedance\SeedanceClient;

$client = new SeedanceClient(); // reads RUNAPI_API_KEY

$task = $client->textToVideo->create([
    'model' => 'seedance-2.0',
    'prompt' => 'A cat walking through a garden',
]);

$status = $client->textToVideo->get($task->id);

$result = $client->textToVideo->run([
    'model' => 'seedance-2.0',
    'prompt' => 'A cinematic product reveal with dramatic lighting',
]);

echo $result->videos[0]->url . PHP_EOL;