Giter Site home page Giter Site logo

ardagnsrn / elevenlabs-laravel Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 2.0 71 KB

This is an Open Source PHP Laravel package for ElevenLabs Text to Speech API.

Home Page: https://packagist.org/packages/ardagnsrn/elevenlabs-laravel

License: MIT License

PHP 100.00%
ai ai-speech ai-tts elevenlabs elevenlabs-api laravel text-to-speech tts tts-ai tts-api

elevenlabs-laravel's Introduction

elevenlabs-js

ElevenLabs.io API for PHP Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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 :)

Buy Me A Coffee

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

Method Parameters EndPoint HTTP Method
textToSpeech() voiceId, text, modelId, voiceSettings /v1/text-to-speech/{voice_id}/stream POST
getModels() N/A /v1/models GET

Parameters

Parameter Type Description Required Default
voiceId String The ID of the voice to use. You can get a list of available voices using getVoices(). Yes N/A
text String The text to convert to speech. Yes N/A
modelId String The ID of the model to use. You can get a list of available models using getModels(). No eleven_multilingual_v2
voiceSettings Array The settings to use for the voice. No ['stability' => 0.95, 'similarity_boost' => 0.75, 'style' => 0.06, 'use_speaker_boost' => true]

Voice Settings

Parameter Type Description Default
stability Float The stability of the voice. 0.95
similarity_boost Float The similarity boost of the voice. 0.75
style Float The style of the voice. 0.06
use_speaker_boost Boolean Whether to use speaker boost or not. true

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.

elevenlabs-laravel's People

Contributors

ardagnsrn avatar dependabot[bot] avatar github-actions[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.