Overview
revolution/voicevox-core is a pure PHP package that wraps the VOICEVOX CORE C dynamic library via PHP FFI. VOICEVOX is a high-quality Japanese text-to-speech (TTS) engine. With this package, you can perform speech synthesis directly from PHP.If you want to understand how PHP FFI works and its constraints first, see PHP FFI.
Requirements
- PHP 8.3+
ext-ffiextension enabled- 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.
Download voicevox_core
Download the downloader for your OS and architecture from voicevox_core releases and run it. It creates a
voicevox_core directory in your current directory.The created directory structure:Alternative: Use an environment variable
If you cannot create a symbolic link, set the full path to the library file in theVOICEVOX_CORE_LIB_PATH environment variable:
On macOS, if
DYLD_FALLBACK_LIBRARY_PATH does not work, use VOICEVOX_CORE_LIB_PATH instead.Documentation
Usage
Basic usage and code samples for TTS and speech synthesis.
API Reference
Detailed reference for all classes, methods, and enums.
Links
- GitHub: invokable/voicevox-core-php
- VOICEVOX CORE: VOICEVOX/voicevox_core