PHP code example of innovination / elevenlabs

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

    

innovination / elevenlabs example snippets


use Innovination\Elevenlabs;

$elevenlabs = new ElevenLabs();

XI_API_KEY='your-api-key'

//Required
$elevenlabs->voice_id = 'voice-id-on-elevenlabs';
$elevenlabs->text = "Hello, world!";
//Optional
$elevenlabs->file_prefix = "prefix"; // default is audio
$elevenlabs->path = "folder-name"; //default folder is audio
$audioFile = $elevenlabs->generateAudio();