> ## 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 Core for PHP

> Een pure PHP-pakket dat de dynamische C-bibliotheek van VOICEVOX CORE wrapt met PHP FFI. Gebruik tekst-naar-spraak (TTS) rechtstreeks vanuit PHP.

## Overzicht

[revolution/voicevox-core](https://github.com/invokable/voicevox-core-php) is een pure PHP-pakket dat de dynamische C-bibliotheek van [VOICEVOX CORE](https://github.com/VOICEVOX/voicevox_core) wrapt met PHP FFI.

VOICEVOX is een hoogwaardige Japanse tekst-naar-spraak-engine (TTS), en met dit pakket kun je rechtstreeks vanuit PHP spraak synthetiseren.

> [!NOTE]
>
> Wil je eerst de werking en beperkingen van PHP FFI zelf op een rij hebben, zie dan [PHP FFI](https://kawax.biz/nl/advanced/ffi.md).

> [!TIP]
>
> Werk je vanuit een Laravel-app, lees dan ook [VOICEVOX for Laravel](https://kawax.biz/nl/packages/laravel-voicevox.md) — dan begrijp je ook meteen het verschil tussen de clientmodus en de native modus.

> [!WARNING]
>
> Omdat PHP FFI in webserveromgevingen (zoals FPM) vaak is uitgeschakeld (`ffi.enable=false`), is dit pakket **bedoeld voor gebruik in een lokale CLI**.

## Vereisten

* PHP 8.3+
* De `ext-ffi`-extensie is ingeschakeld
* VOICEVOX CORE 0.17.1+

## Installatie

```bash theme={null}
composer require revolution/voicevox-core
```

## De bibliotheek opzetten

Om dit pakket te gebruiken heb je de dynamische bibliotheek van VOICEVOX CORE (`.so` / `.dylib`), de ONNX Runtime-bibliotheek en het OpenJTalk-woordenboek nodig.

**1. Download voicevox\_core**

Download de downloader die past bij je OS en architectuur via [voicevox\_core releases](https://github.com/VOICEVOX/voicevox_core/releases) en voer die uit. Na uitvoering wordt in de huidige directory een `voicevox_core`-directory aangemaakt.

De aangemaakte directorystructuur:

```
voicevox_core/
├── dict/open_jtalk_dic_*/     # OpenJTalk-woordenboek
├── c_api/lib/                 # Dynamische bibliotheken (.so, .dylib)
├── models/vvms/               # Spraakmodelbestanden (.vvm)
└── onnxruntime/               # ONNX Runtime-bibliotheek
```

**2. Verplaats naar een permanente locatie**

```bash theme={null}
mv voicevox_core ~/.local/voicevox_core
```

**3. Maak een symbolische link (aanbevolen)**

Maak een symbolische link zodat de bibliotheek automatisch wordt gevonden.

> [!WARNING]
>
> Gebruik voor `ln -s` altijd een **absoluut pad**.

**macOS:**

```bash theme={null}
# Vervang [VOICEVOX_CORE_DIR] door het absolute pad van voicevox_core
ln -s [VOICEVOX_CORE_DIR]/libvoicevox_core.dylib /usr/local/lib/libvoicevox_core.dylib
```

Als het laden vanuit `/usr/local/lib/` niet lukt, stel dan `DYLD_FALLBACK_LIBRARY_PATH` in via bijvoorbeeld `.zshrc`:

```bash theme={null}
export DYLD_FALLBACK_LIBRARY_PATH="$HOME/lib:/usr/local/lib:/usr/lib"
```

**Linux:**

```bash theme={null}
ln -s [VOICEVOX_CORE_DIR]/libvoicevox_core.so /usr/local/lib/libvoicevox_core.so
```

### Alternatief: opgeven via een omgevingsvariabele

Als je geen symbolische link kunt maken, stel dan het volledige pad naar het bibliotheekbestand in via de omgevingsvariabele `VOICEVOX_CORE_LIB_PATH`:

```bash theme={null}
export VOICEVOX_CORE_LIB_PATH=/path/to/libvoicevox_core.dylib
```

```bash theme={null}
export VOICEVOX_CORE_LIB_PATH="$HOME/.local/voicevox_core/c_api/lib/libvoicevox_core.dylib"
```

> [!NOTE]
>
> Als het laden op macOS ook met `DYLD_FALLBACK_LIBRARY_PATH` niet lukt, stel het dan in via `VOICEVOX_CORE_LIB_PATH`.

## Documentatie

> [card] [Gebruik](https://kawax.biz/nl/packages/voicevox-core-php/usage.md)
>
> Basisgebruik van tekst-naar-spraak en spraaksynthese, met codevoorbeelden.

> [card] [API-referentie](https://kawax.biz/nl/packages/voicevox-core-php/api.md)
>
> Gedetailleerde referentie van alle klassen, methodes en enums.

## Referentielinks

* GitHub: [invokable/voicevox-core-php](https://github.com/invokable/voicevox-core-php)
* VOICEVOX CORE: [VOICEVOX/voicevox\_core](https://github.com/VOICEVOX/voicevox_core)


## Related topics

- [Gebruik - VOICEVOX Core for PHP](https://kawax.biz/nl/packages/voicevox-core-php/usage.md)
- [API-referentie - VOICEVOX Core for PHP](https://kawax.biz/nl/packages/voicevox-core-php/api.md)
- [VOICEVOX for Laravel](https://kawax.biz/nl/packages/laravel-voicevox/index.md)
- [PHP FFI](https://kawax.biz/nl/advanced/ffi.md)
- [Installatie en configuratie - VOICEVOX for Laravel](https://kawax.biz/nl/packages/laravel-voicevox/installation.md)


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