PHP code example of ardagnsrn / elevenlabs-laravel

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

    

ardagnsrn / elevenlabs-laravel example snippets


return [
    'api_key' => env('ELEVENLABS_API_KEY'),
];

$elevenLabs = new ArdaGnsrn\ElevenLabs();
$response = $elevenLabs->textToSpeech('YOUR_VOICE_ID', 'Hello World!', 'eleven_multilingual_v2', [
    'stability' => 0.95, 
    'similarity_boost' => 0.75, 
    'style' => 0.06, 
    'use_speaker_boost' => true
]);

// If you want, you can save to storage like this:
$response->saveFile('audio.mp3');

// Or you can get the response and do whatever you want with it:
$response->getResponse();

$elevenLabs = new ArdaGnsrn\ElevenLabs();
$models = $elevenLabs->getModels();
bash
php artisan vendor:publish --tag="elevenlabs-laravel-config"