Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/phpaisdk/elevenlabs/llms.txt

Use this file to discover all available pages before exploring further.

The ElevenLabs provider integrates ElevenLabs’ full generative media suite into the PHP AI SDK. Install one Composer package to unlock text-to-speech, realtime transcription, voice design, music composition, dubbing, and a collection of audio transforms — all accessible through a clean static facade or a configured provider instance.

Installation

Add the package with Composer and get your API key configured in minutes.

Configuration

Set your API key, override the base URL, or pass custom headers.

Speech Generation

Generate speech with any ElevenLabs voice using the portable SDK API.

Transcription

Transcribe audio files with Scribe v2, including diarization and timestamps.

Realtime Transcription

Stream live audio over WebSocket with Scribe v2 Realtime.

Media Services

Voice changer, music, sound effects, dialogue, dubbing, and more.

What’s included

The package ships three PHP AI SDK model implementations and eight provider-owned media resource classes.

Speech (TTS)

eleven_flash_v2_5, eleven_v3, and any ElevenLabs TTS model ID — integrated with Generate::speech().

Transcription (STT)

Scribe v2 batch transcription with word-level timestamps, diarization, and multichannel support.

Realtime Transcription

WebSocket-based Scribe v2 Realtime with partial and committed transcript events.

Voice Changer

Convert audio to a target voice via speech-to-speech.

Voice Isolator

Remove background noise and isolate the primary voice from any audio file.

Voice Design

Generate voice previews from a text description, then save the best one.

Music

Compose, plan, get detailed metadata, convert video to music, and separate stems.

Sound Effects

Generate sound effects from a text prompt in one call.

Dialogue

Render multi-voice dialogue with optional per-character alignment timestamps.

Dubbing

Translate and dub video or audio into any target language asynchronously.

Forced Alignment

Align a supplied audio file to its transcript at word and character level.

Data Types

Typed result objects returned by every resource method.

Quick example

use AiSdk\ElevenLabs;
use AiSdk\Generate;

ElevenLabs::create(['apiKey' => 'xi-...']);

// Text-to-speech
$result = Generate::speech('Hello from the PHP AI SDK.')
    ->model(ElevenLabs::model('eleven_flash_v2_5'))
    ->voice('JBFqnCBsd6RMkjVDRZzb')
    ->run();

$result->output->save(__DIR__.'/hello.mp3');

// Music composition
$music = ElevenLabs::music()->compose('Warm acoustic guitar intro.');
$music->output->save(__DIR__.'/intro.mp3');
1

Install the package

composer require aisdk/elevenlabs
2

Set your API key

export ELEVENLABS_API_KEY=xi-...
Or pass it directly: ElevenLabs::create(['apiKey' => 'xi-...']).
3

Generate your first audio

Call Generate::speech() with an ElevenLabs model and voice ID, or jump straight to a media service like ElevenLabs::music()->compose().

Build docs developers (and LLMs) love