PHPackages                             b7s/whisper-php - 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. b7s/whisper-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

b7s/whisper-php
===============

Transform audio into text with Whisper.cpp AI - directly in PHP

v1.2.51(5mo ago)23544↓70.7%2MITPHPPHP ^8.2

Since Dec 2Pushed 5mo agoCompare

[ Source](https://github.com/b7s/whisper-php)[ Packagist](https://packagist.org/packages/b7s/whisper-php)[ RSS](/packages/b7s-whisper-php/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (3)Versions (11)Used By (0)

[![[Whisper PHP logo]](docs/whisper-php-logo.webp)](docs/whisper-php-logo.webp)Whisper for PHP
===============

[](#whisper-for-php)

🎙️ **Transform audio into text with Whisper.cpp AI - directly in PHP!**

A powerful, standalone PHP library that brings state-of-the-art speech recognition to your applications. Built on Whisper.cpp for blazing-fast performance, with zero Laravel dependencies. Transcribe, translate, and analyze audio in 99+ languages with a beautiful fluent API.

---

✨ **Features:**

- 🚀 Fast local transcription (no API calls, no costs)
- 🌍 99+ languages supported
- 🎯 High accuracy with multiple model sizes
- 💬 Speaker detection and timestamps
- 📝 Export to SRT, VTT, JSON, CSV
- 🔄 Real-time progress tracking
- 🎨 Fluent Laravel-style API
- 🎬 Video support with automatic audio extraction
- 📦 Smart chunking for large audio/video files
- 🔒 Privacy-first (all processing happens locally)
- 🧪 Real tests ([see here](examples/example-models.php))

---

```
echo (new Whisper)
    ->audio('/path/to/audio.mp3')
    ->toText();
```

---

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Composer 2.x
- curl (for downloads)
- FFmpeg (will be downloaded automatically if not installed)

Installation
------------

[](#installation)

```
composer require b7s/whisper-php
```

After installation, run the setup command to download Whisper binaries and models:

```
php ./vendor/bin/whisper-setup
```

> Compile for GPU; if that fails, compile for CPU.

This will download:

- Whisper binary (~50-100 MB)
- Model file (~100-500 MB depending on size)
- FFmpeg binary (~50-80 MB)

### Build Dependencies (for compilation)

[](#build-dependencies-for-compilation)

When running `whisper-setup`, the library compiles Whisper from source. The following build tools are required:

**Linux (Ubuntu/Debian):**

```
sudo apt install git cmake make build-essential
```

**macOS:**

```
brew install git cmake make
```

**Other Linux distributions:**

- **Fedora/RHEL:** `sudo dnf install git cmake make gcc-c++`
- **Arch Linux:** `sudo pacman -S git cmake make gcc`

> These tools are only needed during initial setup. After compilation, they're not required for normal operation.

### Setup Options

[](#setup-options)

```
# Use a different model
php ./vendor/bin/whisper-setup --model=small

# Specify language
php ./vendor/bin/whisper-setup --model=large --language=pt

# Custom data directory
php ./vendor/bin/whisper-setup --dir=/custom/path

# Show help
php ./vendor/bin/whisper-setup --help
```

See [Available Models](#available-models): `tiny`, `tiny.en`, `base`, `base.en`, `small`, `small.en`, `medium`, `medium.en`, `large`

### Check Installation Status

[](#check-installation-status)

```
php ./vendor/bin/whisper-status
```

This will show:

- Binary installation status
- Model installation status
- FFmpeg availability
- GPU support detection (fallback to CPU)

Basic Usage
-----------

[](#basic-usage)

```
