> ## Documentation Index
> Fetch the complete documentation index at: https://kawax.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# VOICEVOX for Laravel

> Overview of the package for working with VOICEVOX from Laravel via client, native, and engine APIs, with links to each mode.

## Overview

[revolution/laravel-voicevox](https://github.com/invokable/laravel-voicevox) is a package for working with VOICEVOX from Laravel.

You can use both the client mode, which connects to the official engine over HTTP, and the native mode, which synthesizes directly through PHP FFI in combination with [VOICEVOX Core for PHP](https://kawax.biz/en/packages/voicevox-core-php.md) — all with the same Laravel-native style.

> [!NOTE]
>
> If you'd like a primer on FFI first, see [PHP FFI](https://kawax.biz/en/advanced/ffi.md). For setting up the core library itself, see [VOICEVOX Core for PHP](https://kawax.biz/en/packages/voicevox-core-php.md) and [usage](https://kawax.biz/en/packages/voicevox-core-php/usage.md).

## Feature matrix

| Feature | Supported | Description |
| - | - | - |
| VOICEVOX client | ✅ | Accesses the official VOICEVOX engine API over HTTP. FFI is not required. |
| VOICEVOX core | ✅ | Uses the VOICEVOX CORE dynamic library via [VOICEVOX Core for PHP](https://kawax.biz/en/packages/voicevox-core-php.md). |
| Laravel style | ✅ | Facades, helpers, `config/voicevox.php`, and `.env` for a Laravel-native experience. |
| Laravel AI SDK integration | ✅ | Usable from the Laravel AI SDK's Audio workflow. |
| VOICEVOX engine | ⚠️ | Provides a VOICEVOX-compatible API inside your Laravel app. Unsupported parts fall back to the official engine. |
| VOICEVOX engine / OpenAI-compatible TTS API | ✅ | Like the AI SDK, `/v1/audio/speech` `voice` supports style IDs and aliases such as "Zundamon". |
| VOICEVOX editor | ⚠️ | A song-focused macOS app was developed, but there are no plans to publish or distribute it on the App Store. Some day, if the code is published on GitHub, you'll be able to build it with Xcode. |

## Requirements

* PHP 8.3+
* Laravel 12+
* `ext-zip`
* `ext-ffi` when using native mode / the engine API
* Local CLI environment

> [!WARNING]
>
> In common web server environments — including Laravel Cloud — FFI is usually disabled, so treat native mode and the engine API as **local-CLI only**.

## Mode list

| Mode | How it runs | FFI | Primary use | Guide |
| - | - | - | - | - |
| Client Talk | HTTP request to the official engine | Not required | Text-to-speech synthesis | [client-talk](https://kawax.biz/en/packages/laravel-voicevox/client-talk.md) |
| Client Song | HTTP request to the official engine | Not required | Singing voice synthesis | [client-song](https://kawax.biz/en/packages/laravel-voicevox/client-song.md) |
| Native Talk | Calls VOICEVOX CORE directly via FFI | Required | Local text-to-speech synthesis | [native-talk](https://kawax.biz/en/packages/laravel-voicevox/native-talk.md) |
| Native Song | Calls VOICEVOX CORE directly via FFI | Required | Local singing voice synthesis | [native-song](https://kawax.biz/en/packages/laravel-voicevox/native-song.md) |
| Engine API | Provides a compatible API inside the Laravel app | Required | Embedding a VOICEVOX-compatible API | [installation](https://kawax.biz/en/packages/laravel-voicevox/installation.md) |

## Why `tap()` fits well

This package returns an Audio Query object right after `talk()` / `song()`, letting you insert an adjustment phase before `generate()`.

`tap()` therefore reads naturally as "adjust the query without changing the return value".

```php theme={null}
use Revolution\Voicevox\Client\TalkAudioQuery;
use Revolution\Voicevox\Voicevox;

$response = Voicevox::talk('You can tweak with tap, na no da', id: 1)
    ->tap(function (TalkAudioQuery $talk) {
        $talk->audioQuery['speedScale'] = 1.2;
    })
    ->generate(id: 1);
```

* For Talk, you can tweak `speedScale`, `pitchScale`, and so on.
* For Song, you can recompute F0 and volume with `sync()`.
* It chains cleanly into the `VoicevoxResponse` that `generate()` returns.

> [!NOTE]
>
> The idea behind `tap()` itself is summarized in [The tap() helper and the Tappable trait](https://kawax.biz/en/advanced/tap.md). This package is an especially clear practical example.

## Documentation

> [card] [Installation](https://kawax.biz/en/packages/laravel-voicevox/installation.md)
>
> Client-only setup, FFI-based setup, publishing the config file, and preparing engine resources.

> [card] [Client Talk](https://kawax.biz/en/packages/laravel-voicevox/client-talk.md)
>
> Get started with text-to-speech via the official VOICEVOX engine.

> [card] [Client Song](https://kawax.biz/en/packages/laravel-voicevox/client-song.md)
>
> Compose `Score` and `Note` to synthesize singing voices.

> [card] [Native Talk](https://kawax.biz/en/packages/laravel-voicevox/native-talk.md)
>
> Synthesize locally with PHP FFI and VOICEVOX CORE.

> [card] [Native Song](https://kawax.biz/en/packages/laravel-voicevox/native-song.md)
>
> Use singing voice models directly through FFI.

> [card] [VOICEVOX Core for PHP](https://kawax.biz/en/packages/voicevox-core-php.md)
>
> Set up the core library and use it from pure PHP.

## Reference links

* GitHub: [invokable/laravel-voicevox](https://github.com/invokable/laravel-voicevox)
* VOICEVOX Core for PHP: [/en/packages/voicevox-core-php](https://kawax.biz/en/packages/voicevox-core-php.md)
* VOICEVOX Core for PHP usage: [/en/packages/voicevox-core-php/usage](https://kawax.biz/en/packages/voicevox-core-php/usage.md)
* PHP FFI: [/en/advanced/ffi](https://kawax.biz/en/advanced/ffi.md)
* `tap()` helper: [/en/advanced/tap](https://kawax.biz/en/advanced/tap.md)
* Official VOICEVOX engine: [VOICEVOX/voicevox\_engine](https://github.com/VOICEVOX/voicevox_engine)


## Related topics

- [VoicevoxResponse - VOICEVOX for Laravel](https://kawax.biz/en/packages/laravel-voicevox/response.md)
- [Laravel AI SDK Integration - VOICEVOX for Laravel](https://kawax.biz/en/packages/laravel-voicevox/ai-sdk.md)
- [Installation and setup - VOICEVOX for Laravel](https://kawax.biz/en/packages/laravel-voicevox/installation.md)
- [Getting started - VOICEVOX for Laravel](https://kawax.biz/en/packages/laravel-voicevox/getting-started.md)
- [Configuration reference - VOICEVOX for Laravel](https://kawax.biz/en/packages/laravel-voicevox/configuration.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.