PHP code example of runapi-ai / wan

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




unApi\Wan\WanClient;

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

$task = $client->textToVideo->create([
    'model' => 'wan-2.7-text-to-video',
    'prompt' => 'A scenic mountain landscape',
]);

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

$result = $client->textToVideo->run([
    'model' => 'wan-2.7-text-to-video',
    'prompt' => 'A wide aerial shot over a snowy mountain ridge',
]);

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