PHPackages                             displace/ext-whisper - 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. displace/ext-whisper

ActivePhp-ext[Utility &amp; Helpers](/categories/utility)

displace/ext-whisper
====================

PHP 8.3+ native, in-process speech-to-text via whisper.cpp: 16kHz WAV in, text + timestamped segments out.

v0.1.0(1mo ago)02MITRustPHP ^8.3CI passing

Since Jun 11Pushed 1mo agoCompare

[ Source](https://github.com/DisplaceTech/ext-whisper)[ Packagist](https://packagist.org/packages/displace/ext-whisper)[ Docs](https://github.com/DisplaceTech/ext-whisper)[ RSS](/packages/displace-ext-whisper/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

ext-whisper
===========

[](#ext-whisper)

 **Local speech-to-text for PHP, in-process.**
 16kHz WAV in, text + timestamped segments out — no Python sidecar, no remote API, no audio leaving the box.

 [![CI](https://github.com/DisplaceTech/ext-whisper/actions/workflows/ci.yml/badge.svg)](https://github.com/DisplaceTech/ext-whisper/actions/workflows/ci.yml) [![PHP 8.3 / 8.4 / 8.5](https://camo.githubusercontent.com/f8c66ec3458748baee370b7844203c334e62735196a3c31b11c504ab609f4be7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e33253230253743253230382e34253230253743253230382e352d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/f8c66ec3458748baee370b7844203c334e62735196a3c31b11c504ab609f4be7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e33253230253743253230382e34253230253743253230382e352d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465) [![Pre-release](https://camo.githubusercontent.com/9f096097aa41a5a065f1cfb6503ce800e794f0734b4ab8dc18231d463db099c5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5374617475732d7072652d2d72656c656173652d6f72616e6765)](https://camo.githubusercontent.com/9f096097aa41a5a065f1cfb6503ce800e794f0734b4ab8dc18231d463db099c5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5374617475732d7072652d2d72656c656173652d6f72616e6765) [![MIT License](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)](LICENSE) [![Documentation](https://camo.githubusercontent.com/e07cf1d79a5f4c3f189636420bea6c4ae1a2105fbf7d23a6048a11f66e4e81f4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d776869737065722e646973706c6163652e746563682d626c7565)](https://whisper.displace.tech)

---

What is ext-whisper?
--------------------

[](#what-is-ext-whisper)

`ext-whisper` is a PHP 8.3+ extension that loads a [whisper.cpp](https://github.com/ggml-org/whisper.cpp) model and runs speech-to-text *in the PHP process*, on CPU. Written in Rust on top of [`ext-php-rs`](https://github.com/davidcole1340/ext-php-rs) and [`whisper-rs`](https://github.com/tazz4843/whisper-rs).

- 🎙️ **Transcription with timestamps** — full text plus time-aligned segments, offsets in seconds.
- 🧾 **Contracts-shaped output** — segment rows match [`Displace\AI\Contracts\Transcriber`](https://github.com/DisplaceTech/ai-contracts) exactly; the adapter is two lines.
- 🧰 **Actionable errors** — a non-conforming WAV throws with the precise ffmpeg one-liner that fixes it.
- 🌍 **Multilingual + translate** — `['language' => 'de']` hints, `['translate' => true]` to English (multilingual models).
- 🧵 **Thread-safe by construction** — one model handle, a fresh whisper state per call, no shared mutable state.
- 🤫 **Quiet by default** — whisper.cpp's stderr firehose is silenced; `EXT_WHISPER_LOG=1` restores it.

Quick start
-----------

[](#quick-start)

```
mkdir -p models
curl -L -o models/ggml-tiny.en.bin \
    https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.en.bin

make build
php -d extension=$PWD/target/debug/libwhisper.so examples/transcribe.php \
    models/ggml-tiny.en.bin tests/fixtures/jfk.wav
```

```
