Overview
revolution/voicevox-core is a pure PHP package that wraps VOICEVOX CORE’s C dynamic library via PHP FFI. VOICEVOX is a high-quality Japanese text-to-speech (TTS) engine, and this package lets you perform synthesis directly from PHP.If you want to first review how PHP FFI works and its limitations, see PHP FFI.
Requirements
- PHP 8.3+
ext-ffienabled- VOICEVOX CORE 0.16+
Installation
Library setup
To use this package, you need the VOICEVOX CORE dynamic library (.so / .dylib), the ONNX Runtime library, and the OpenJTalk dictionary.
1
Download voicevox_core
Download the downloader that matches your OS and architecture from the voicevox_core releases and run it. A
voicevox_core directory is created in the current directory.The generated directory structure:2
Move it to a permanent location
3
Create a symlink (recommended)
Create a symlink so the library can be located automatically.macOS:If loading from Linux:
/usr/local/lib/ fails, set DYLD_FALLBACK_LIBRARY_PATH in .zshrc or similar:Alternative: specifying via environment variable
If you can’t create a symlink, set the full path to the library file in theVOICEVOX_CORE_LIB_PATH environment variable:
On macOS, if loading still fails even with
DYLD_FALLBACK_LIBRARY_PATH, set VOICEVOX_CORE_LIB_PATH instead.Documentation
Usage
Basic usage and code samples for text-to-speech and audio synthesis.
API reference
Detailed reference for every class, method, and enum.
Reference links
- GitHub: invokable/voicevox-core-php
- VOICEVOX CORE: VOICEVOX/voicevox_core