Skip to content

v0.1.0 — local speech-to-text for PHP

Latest

Choose a tag to compare

@github-actions github-actions released this 11 Jun 21:16
· 6 commits to main since this release
74444c0

The first release of ext-whisper: a PHP 8.3+ extension that loads a whisper.cpp model and transcribes audio inside the PHP process — no Python sidecar, no remote API, no audio leaving the box.

php pie.phar install displace/ext-whisper
use Displace\Whisper\Model;

$model  = Model::load('models/ggml-tiny.en.bin');
$result = $model->transcribe('meeting.wav');

echo $result->text();
foreach ($result->segments() as $s) {
    printf("[%6.2fs → %6.2fs] %s\n", $s['start'], $s['end'], $s['text']);
}

What's in v0.1.0

  • Model::load() / transcribe() / close() — whisper.cpp models from the Hugging Face zoo (tiny.en at 75MB is enough for clean English speech). Transcribe options: language (ISO 639-1 hint), translate (to English, multilingual models), threads.
  • Transcription — full text plus time-aligned segments with offsets in seconds. Segment rows are deliberately the exact shape of Displace\AI\Contracts\Transcriber, so the framework adapter is two lines.
  • Strict, helpful audio handling — input is 16kHz mono 16-bit PCM WAV, full stop. Anything else throws AudioException with the exact ffmpeg one-liner that produces a conforming file (ffmpeg -i in.mp3 -ar 16000 -ac 1 -c:a pcm_s16le out.wav). Resampling is a quality decision the caller should own; decoding is the headline v0.2 candidate.
  • Thread-safe by construction — the model context is shared read-only; every call builds and drops its own whisper state.
  • Quiet by default — whisper.cpp's stderr logging is silenced; EXT_WHISPER_LOG=1 restores it.
  • Typed exceptions rooted at WhisperException (extends \RuntimeException).

The pipeline this completes

Transcribe (ext-whisper) → chunk (ai-toolkit) → embed (ext-infer) → search (ext-turbovec): searchable audio archives, entirely on your hardware.

Binaries

Prebuilt PIE archives for PHP 8.3 / 8.4 / 8.5 × macOS arm64 / Linux x86_64 / Linux arm64 (NTS), each with a SHA-256 sidecar. THIRD-PARTY-LICENSES.html is the transitive license manifest for everything statically linked (whisper.cpp MIT, whisper-rs Unlicense, hound Apache-2.0 — see THIRD-PARTY-NOTICES.md).

Docs: whisper.displace.tech

Deliberately out of scope for v0.1: audio decoding (mp3/m4a/ogg), streaming/realtime transcription, speaker diarization, word-level timestamps, GPU-default builds, Windows. See PLAN.md for the v0.2 candidates.