ardagnsrn / elevenlabs-laravel
This is an Open Source Laravel package for ElevenLabs Text to Speech API.
Fund package maintenance!
www.buymeacoffee.com/ardagnsrn
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.8
- illuminate/contracts: ^10.0|^11.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.8
- pestphp/pest: ^2.20
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2024-11-14 15:11:53 UTC
README
ElevenLabs.io API for PHP Laravel
This is an Open Source PHP Laravel package for elevenlabs.io Text to Speech API. You can find the Official API document here: https://api.elevenlabs.io/docs
Buy me a coffee
Whether you use this project, have learned something from it, or just like it, please consider supporting it by buying me a coffee, so I can dedicate more time on open-source projects like this :)
Table of Contents
Installation
You can install the package via composer:
composer require ardagnsrn/elevenlabs-laravel
You can publish the config file with:
php artisan vendor:publish --tag="elevenlabs-laravel-config"
This is the contents of the published config file:
return [ 'api_key' => env('ELEVENLABS_API_KEY'), ];
Supported Methods
Parameters
Voice Settings
Usage
textToSpeech() Method
Generate a text to speech audio file. You can either save the file or get the pipe and do whatever you want with it.
$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();
getModels() Method
Get a list of available models.
$elevenLabs = new ArdaGnsrn\ElevenLabs(); $models = $elevenLabs->getModels();
Testing
composer test
Other Languages
Also, you can find the other languages of this package here:
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.