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

$task = $client->textToVideo->create([
    'model' => 'runway',
    'prompt' => 'A precise product render on white marble',
    'aspect_ratio' => '16:9',
    'duration_seconds' => 5,
    'output_resolution' => '720p',
]);

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

$result = $client->textToVideo->run([
    'model' => 'runway',
    'prompt' => 'A serene mountain lake at dawn',
    'aspect_ratio' => '16:9',
    'duration_seconds' => 5,
    'output_resolution' => '720p',
]);

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