PHPackages                             saarnilauri/ai-provider-for-elevenlabs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. saarnilauri/ai-provider-for-elevenlabs

ActiveWordpress-plugin[Utility &amp; Helpers](/categories/utility)

saarnilauri/ai-provider-for-elevenlabs
======================================

ElevenLabs provider for the WordPress AI API.

v0.1.2(2mo ago)31GPL-2.0-or-laterPHPPHP &gt;=7.4

Since Mar 2Pushed 2mo agoCompare

[ Source](https://github.com/saarnilauri/ai-provider-for-elevenlabs)[ Packagist](https://packagist.org/packages/saarnilauri/ai-provider-for-elevenlabs)[ Docs](https://github.com/saarnilauri/ai-provider-for-elevenlabs)[ RSS](/packages/saarnilauri-ai-provider-for-elevenlabs/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (11)Versions (4)Used By (0)

AI Provider for ElevenLabs
==========================

[](#ai-provider-for-elevenlabs)

A third-party provider for [ElevenLabs](https://elevenlabs.io/) in the [PHP AI Client](https://github.com/WordPress/php-ai-client) SDK. Works as both a Composer package and a WordPress plugin.

This project is independent and is not affiliated with, endorsed by, or sponsored by ElevenLabs.

Features
--------

[](#features)

- **Text-to-Speech** -- high-quality voice synthesis with many voices and models
- **Sound Effects Generation** -- generate sound effects from text prompts
- **Voice Directory** -- list and discover available voices (including cloned voices)
- Automatic provider registration in WordPress
- Dynamic model discovery from the ElevenLabs API

Requirements
------------

[](#requirements)

- PHP 7.4 or higher
- [wordpress/php-ai-client](https://github.com/WordPress/php-ai-client) ^1.1 must be installed

Installation
------------

[](#installation)

### As a Composer Package

[](#as-a-composer-package)

```
composer require saarnilauri/ai-provider-for-elevenlabs
```

The Composer distribution is intended for library usage and excludes `plugin.php`.

### As a WordPress Plugin

[](#as-a-wordpress-plugin)

1. Download `ai-provider-for-elevenlabs.zip` from [GitHub Releases](https://github.com/saarnilauri/ai-provider-for-elevenlabs/releases) (do not use GitHub "Source code" archives)
2. Upload the ZIP in WordPress admin via Plugins &gt; Add New Plugin &gt; Upload Plugin
3. Ensure the PHP AI Client plugin is installed and activated
4. Activate the plugin through the WordPress admin

Configuration
-------------

[](#configuration)

Set your ElevenLabs API key via the `ELEVENLABS_API_KEY` environment variable:

```
putenv('ELEVENLABS_API_KEY=your-api-key');
```

You can obtain an API key at .

API Key Permissions
-------------------

[](#api-key-permissions)

ElevenLabs API keys can be scoped with specific permissions. The minimum permissions required depend on which features you use:

PermissionRequired forNotesText-to-speechText-to-speech generationRequired for TTS functionalitySound generationSound effects generationRequired for sound effectsModelsDynamic model discoveryOptional -- the plugin falls back to a hardcoded model list when this permission is missingVoicesListing available voicesOnly needed if you use the `VoiceDirectory` to browse voicesFor full functionality, grant **Text-to-speech**, **Sound generation**, **Models**, and **Voices** permissions. For a minimal TTS-only setup, **Text-to-speech** alone is sufficient.

You can manage API key permissions at .

Usage
-----

[](#usage)

### With WordPress

[](#with-wordpress)

The provider automatically registers itself with the PHP AI Client on the `init` hook. Simply ensure both plugins are active and configure your API key.

### As a Standalone Package

[](#as-a-standalone-package)

```
use WordPress\AiClient\AiClient;
use AiProviderForElevenLabs\Provider\ProviderForElevenLabs;

// Register the provider
$registry = AiClient::defaultRegistry();
$registry->registerProvider(ProviderForElevenLabs::class);

// Set your API key
putenv('ELEVENLABS_API_KEY=your-api-key');
```

### Text-to-Speech Generation

[](#text-to-speech-generation)

```
use WordPress\AiClient\AiClient;
use WordPress\AiClient\Providers\Models\DTO\ModelConfig;

// Simple TTS -- returns a File object with base64-encoded audio.
$audio = AiClient::prompt( 'Hello, this is a test of ElevenLabs text to speech.' )
    ->usingProvider( 'elevenlabs' )
    ->usingModelConfig( ModelConfig::fromArray( [
        'outputSpeechVoice' => 'JBFqnCBsd6RMkjVDRZzb', // Voice ID (required)
    ] ) )
    ->convertTextToSpeech();

// Save the audio file.
file_put_contents( 'output.mp3', base64_decode( $audio->toAudioFile()->getBase64Data() ) );
```

### Text-to-Speech with Custom Voice Settings

[](#text-to-speech-with-custom-voice-settings)

```
$audio = AiClient::prompt( 'Welcome to WordPress.' )
    ->usingProvider( 'elevenlabs' )
    ->usingModelPreference( [ 'eleven_multilingual_v2', 'elevenlabs' ] )
    ->usingModelConfig( ModelConfig::fromArray( [
        'outputSpeechVoice' => 'JBFqnCBsd6RMkjVDRZzb',
        'customOptions'     => [
            'stability'         => 0.7,
            'similarity_boost'  => 0.8,
            'style'             => 0.2,
            'use_speaker_boost' => true,
        ],
    ] ) )
    ->convertTextToSpeech();
```

### Sound Effects Generation

[](#sound-effects-generation)

```
$audio = AiClient::prompt( 'A thunderstorm with heavy rain and distant rolling thunder' )
    ->usingProvider( 'elevenlabs' )
    ->usingModelPreference( [ 'elevenlabs-sound-generation', 'elevenlabs' ] )
    ->usingModelConfig( ModelConfig::fromArray( [
        'customOptions' => [
            'duration_seconds' => 5.0,
            'prompt_influence' => 0.3,
        ],
    ] ) )
    ->generateSpeech();

file_put_contents( 'thunder.mp3', base64_decode( $audio->toAudioFile()->getBase64Data() ) );
```

### Listing Available Voices

[](#listing-available-voices)

The plugin provides a `VoiceDirectory` for discovering available voices from the ElevenLabs `/voices` endpoint.

```
use WordPress\AiClient\AiClient;

// Get the provider instance from the registry.
$provider = AiClient::defaultRegistry()->getProvider( 'elevenlabs' );

// Get the voice directory.
$voiceDirectory = $provider->getVoiceDirectory();

// List all available voices.
$voices = $voiceDirectory->getVoices();
foreach ( $voices as $voice ) {
    echo $voice['id'] . ': ' . $voice['name'] . ' (' . $voice['category'] . ')' . PHP_EOL;
}

// Filter by category (premade, cloned, professional).
$premadeVoices = $voiceDirectory->getVoicesByCategory( 'premade' );

// Get a specific voice by ID.
$voice = $voiceDirectory->getVoice( 'JBFqnCBsd6RMkjVDRZzb' );
if ( $voice ) {
    echo 'Voice: ' . $voice['name'] . PHP_EOL;
}
```

Available Models
----------------

[](#available-models)

Models are dynamically discovered from the ElevenLabs `/models` API endpoint. Common models include:

Model IDNameUse Case`eleven_multilingual_v2`Multilingual v2Best quality multilingual TTS`eleven_turbo_v2_5`Turbo v2.5Low-latency TTS`eleven_turbo_v2`Turbo v2Low-latency TTS (English)`eleven_flash_v2_5`Flash v2.5Fastest TTS`eleven_flash_v2`Flash v2Fast TTS`eleven_monolingual_v1`English v1Legacy English TTS`eleven_multilingual_v1`Multilingual v1Legacy multilingual TTS`elevenlabs-sound-generation`Sound GenerationSound effects from textThe sound generation model is a hardcoded entry (the `/sound-generation` endpoint does not require a model ID).

Voice Settings Defaults
-----------------------

[](#voice-settings-defaults)

When no custom voice settings are provided, the following defaults are used:

SettingDefaultRange`stability`0.50.0 -- 1.0`similarity_boost`0.750.0 -- 1.0`style`0.00.0 -- 1.0`use_speaker_boost`truebooleanOverride any setting via `customOptions` in `ModelConfig`.

Supported Output Formats
------------------------

[](#supported-output-formats)

FormatMIME Type`mp3_44100_128` (default)audio/mpeg`mp3_22050_32`audio/mpeg`pcm_16000`, `pcm_22050`, `pcm_24000`, `pcm_44100`audio/pcm`ulaw_8000`audio/basic`opus_48000_32`, `opus_48000_64`, `opus_48000_128`audio/opus`aac_44100_48`, `aac_44100_64`, `aac_44100_96`, `aac_44100_128`, `aac_44100_192`audio/aacSet the format via `customOptions['output_format']` or `outputMimeType` in `ModelConfig`.

Building the Plugin ZIP
-----------------------

[](#building-the-plugin-zip)

Build a distributable plugin archive locally:

```
make dist
# or:
./scripts/build-plugin-zip.sh
```

The ZIP is created at `dist/ai-provider-for-elevenlabs.zip` and includes `plugin.php`.

Development
-----------

[](#development)

Install development dependencies:

```
composer install
```

Run unit tests:

```
composer test
# or:
composer test:unit
```

Run integration tests (requires `ELEVENLABS_API_KEY`):

```
composer test:integration
```

Run linting:

```
composer lint
```

License
-------

[](#license)

GPL-2.0-or-later

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance86

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

3

Last Release

70d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/79a199c915de8587d998c6f52b3b46e89ff75eeb3d5a940498d4acac02f61f97?d=identicon)[saarnilauri](/maintainers/saarnilauri)

---

Top Contributors

[![saarnilauri](https://avatars.githubusercontent.com/u/36833033?v=4)](https://github.com/saarnilauri "saarnilauri (7 commits)")

---

Tags

wordpressaielevenlabstext-to-speechtts

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/saarnilauri-ai-provider-for-elevenlabs/health.svg)

```
[![Health](https://phpackages.com/badges/saarnilauri-ai-provider-for-elevenlabs/health.svg)](https://phpackages.com/packages/saarnilauri-ai-provider-for-elevenlabs)
```

###  Alternatives

[symfony/ai-platform

PHP library for interacting with AI platform provider.

51927.7k136](/packages/symfony-ai-platform)[aristath/kirki

Extending the WordPress customizer

1.3k73.0k4](/packages/aristath-kirki)[duncan3dc/speaker

Convert text to speech using web services

11539.1k1](/packages/duncan3dc-speaker)[afragen/git-updater

A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs.

3.3k1.6k](/packages/afragen-git-updater)[werd/ivona-speechcloud-sdk-php

IVONA SpeechCloud SDK for PHP

102.1k](/packages/werd-ivona-speechcloud-sdk-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
