innovination/elevenlabs

A simple package to convert text to audio using Elevenlabs API and store it in the storage.

Maintainers

Package info

github.com/viditgoyal3009/elevenlabs

pkg:composer/innovination/elevenlabs

Statistics

Installs: 21

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.2 2024-08-21 09:47 UTC

This package is auto-updated.

Last update: 2026-03-19 10:27:49 UTC


README

This Composer package allows you to convert text into audio using the ElevenLabs API.

Installation

To install this package, you can use Composer. Run the following command in your project directory:

composer require innovination/elevenlabs

Usage

To use this package, follow these steps:

  1. Import the package into your PHP file:
use Innovination\Elevenlabs;
  1. Create an instance of the Elevenlabs class:
$elevenlabs = new ElevenLabs();
  1. Add ElevenLabs API key to your .env file
XI_API_KEY='your-api-key'
  1. Convert text to audio:
//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();

The generateAudio method will return the path to the generated audio file along with status as sucess or error