PHP code example of runapi-ai / runway
1. Go to this page and download the library: Download runapi-ai/runway 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 / runway example snippets
unApi\Runway\RunwayClient;
$client = new RunwayClient(); // reads RUNAPI_API_KEY
$extendVideoTask = $client->extendVideo->create([
'model' => 'runway',
'output_resolution' => '720p',
'prompt' => 'Make it golden hour',
'source_task_id' => 'task_source',
'watermark' => 'sample',
]);
$task = $client->textToVideo->create([
'model' => 'runway',
'aspect_ratio' => '16:9',
'duration_seconds' => 5,
'first_frame_image_url' => 'https://cdn.runapi.ai/public/samples/image.jpg',
'output_resolution' => '720p',
'prompt' => 'A precise product render on white marble',
'watermark' => 'sample',
]);
$status = $client->textToVideo->get($task->id);
$result = $client->textToVideo->run([
'model' => 'runway',
'aspect_ratio' => '16:9',
'duration_seconds' => 5,
'first_frame_image_url' => 'https://cdn.runapi.ai/public/samples/image.jpg',
'output_resolution' => '720p',
'prompt' => 'A serene mountain lake at dawn',
'watermark' => 'sample',
]);
echo $result->videos[0]->url . PHP_EOL;