PHP code example of rayzenai / minimax-laravel

1. Go to this page and download the library: Download rayzenai/minimax-laravel 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/ */

    

rayzenai / minimax-laravel example snippets


use RayzenAI\Minimax\Facades\Minimax;
use Illuminate\Support\Facades\Storage;

// 10 portrait images from one prompt.
$urls = Minimax::image()->generate('a cyberpunk samurai at dusk', 10, [
    'aspect_ratio' => '9:16',
]);

// Voiceover bytes — persist however you like.
$mp3 = Minimax::tts()->synthesize('Hello, world.', ['voice' => 'English_radiant_girl']);
Storage::disk('public')->put('hello.mp3', $mp3);

// Chat completion.
$copy = Minimax::text()->complete('Write a 30-second TikTok hook about coffee.');

// Design a new custom voice.
$voice = Minimax::voice()->design(
    prompt: 'A warm, deep British male narrator. Calm and reassuring.',
    previewText: 'Welcome back to the channel.',
);
// $voice = ['voice_id' => '…', 'trial_audio' => <raw mp3 bytes>]

// List + delete.
$voices = Minimax::voice()->list();          // ['system' => […], 'cloning' => […], 'generation' => […]]
Minimax::voice()->delete($voice['voice_id'], 'voice_generation');