Download the PHP package b7s/whisper-php without Composer

On this page you can find all versions of the php package b7s/whisper-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package whisper-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:



Requirements

Installation

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

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

This will download:

Build Dependencies (for compilation)

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

Linux (Ubuntu/Debian):

macOS:

Other Linux distributions:

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

Setup Options

See Available Models: tiny, tiny.en, base, base.en, small, small.en, medium, medium.en, large

Check Installation Status

This will show:

Basic Usage

Chaining Multiple Options

Switching Models

You can easily switch between models at runtime. The model will be downloaded automatically if not available:

Note: If you experience errors like "not all tensors loaded from model file", your model file may be corrupted. Delete it from ~/.local/share/whisper-php/models/ and re-download using php ./vendor/bin/whisper-setup --model=<model-name>.

See the language tests at Examples Models.

Configuration

The Config class accepts the following parameters:

Parameters:

Model Installation

Performance Tips

  1. Start with base - It's the sweet spot for most applications with multilingual support
  2. Use English-only models when possible - They're faster and more accurate for English (ends with ".en")
  3. Upgrade to small if you need better accuracy
  4. Use medium or large only when accuracy is critical (they're much slower)
  5. Use tiny for real-time applications or testing

Official Documentation

For more details about Whisper models, see:

Fluent API

The library provides a fluent API for configuring transcriptions. Chain methods to customize the behavior:

Basic Transcription

toEnglish (to English)

What it does: Automatically translates speech from any language to English text. Perfect for multilingual content where you need English output regardless of the spoken language.

Use cases:

Language Detection and Specification

Automatic Detection (default): By default, Whisper automatically detects the language being spoken. This works best with multilingual models (base, small, medium, large).

Specify Language for Better Accuracy: If you know the audio language, specifying it improves accuracy and speed:

Use cases:

Export Formats (SRT, VTT, JSON, CSV)

What it does: Exports transcriptions with timestamps in various formats for different use cases.

Use cases:

improveDecode - Beam Search (Better Quality)

What it does: Uses a more sophisticated decoding algorithm that explores multiple possibilities simultaneously, resulting in more accurate transcriptions at the cost of speed. Higher beam size = better quality but slower.

When to use:

When NOT to use:

filterNonSpeech - Voice Activity Detection (VAD)

What it does: Automatically detects which parts of the audio contain speech vs silence/noise. This improves segmentation by only transcribing actual speech, ignoring long pauses, background music, or silence.

Use cases:

Threshold guide:

Context Guidance

What it does: Provides context to the AI model BEFORE transcription starts. This "primes" the model to expect certain words, names, or terminology, dramatically improving accuracy for specialized vocabulary that the model might otherwise mishear.

Use cases:

Tips:

Speaker Detection (Experimental)

What it does: Attempts to identify when different people are speaking in a conversation. Each segment gets a speaker ID (0, 1, 2, etc.) indicating who is talking. Note: This doesn't identify WHO the speakers are, just that they're different people.

Use cases:

Limitations:

Voice Tone Analysis

What it does: Automatically analyzes the audio loudness of each transcribed segment to detect when someone is shouting or speaking very softly. Returns decibel (dBFS) levels and classifies each segment by tone. Useful for moderation, call center analysis, lecture reviews, or any scenario where voice tone matters.

Custom thresholds:

How it works:

Audio is analyzed independently from transcription using the original audio file. Unlike the VAD filter (which detects speech vs silence), this measures actual acoustic energy. The original audio is converted to a clean WAV signal (without normalization) and per-segment RMS energy is computed and converted to dBFS relative to full scale.

Threshold guide:

Use cases:

Result structure:

Progress Callback

What it does: Allows you to monitor transcription progress in real-time. Useful for long audio files where you want to show a progress bar or status updates to users.

Use cases:

Timeout Configuration

What it does: Controls how long the transcription process can run before timing out. Useful for long videos or when you need to prevent processes from hanging indefinitely.

Important: For large video files or long recordings, use ->timeout(null) to disable the timeout completely. The default 20-minute timeout for videos may not be sufficient for files larger than 500MB or recordings longer than 30 minutes.

Default timeouts:

Use cases:

Tips:

Video Support

What it does: Automatically extracts audio from video files using FFmpeg before transcription. Supports all common video formats (MP4, MKV, AVI, MOV, WebM, etc.).

Supported formats:

Use cases:

Chunking for Large Files

What it does: Automatically splits large audio/video files into smaller chunks for processing. This prevents memory issues and enables processing of very long recordings. Timestamps are automatically adjusted to maintain accuracy across chunks.

When to use:

How it works:

  1. Calculates optimal chunk duration based on file size
  2. Splits audio into overlapping segments
  3. Transcribes each chunk independently
  4. Merges results with adjusted timestamps
  5. Returns seamless transcription

Use cases:

Available Models

whisper-php supports all Whisper model sizes. Choose based on your accuracy needs and available resources.

Model Comparison

Model Parameters Size Speed Accuracy Best For
tiny 39M ~75 MB ⚡⚡⚡⚡⚡ Fastest ⭐⭐ Basic Real-time, testing
base 74M ~140 MB ⚡⚡⚡⚡ Very Fast ⭐⭐⭐ Good Recommended for most uses
small 244M ~460 MB ⚡⚡⚡ Fast ⭐⭐⭐⭐ Very Good Production, good quality
medium 769M ~1.5 GB ⚡⚡ Moderate ⭐⭐⭐⭐⭐ Excellent High accuracy needs
large 1550M ~3 GB ⚡ Slow ⭐⭐⭐⭐⭐ Best Maximum accuracy, research

English-Only vs Multilingual

Each model (except large) comes in two variants:

Recommendation: Use .en models if you only transcribe English audio. They're faster and more accurate for English.

Which Model Should You Choose?

For English audio:

For multilingual audio:

For specific use cases:

Real-World Examples

Example 1: Switching Models for Different Accuracy Needs

Example 2: Creating Subtitles for a Video

Example 3: Transcribing Medical Consultation

Example 4: Multilingual Podcast Processing

Example 5: Processing Customer Support Calls

Example 6: Batch Processing with Queue

Working with TranscriptionResult

Logging

You can implement your own logging class by implementing the WhisperPHP\Logger interface:

Testing

Note: Integration tests require Whisper to be set up and will download the tiny model (~75MB) for faster execution.

License

MIT


**Made with ❤️ 🐱 by Bruno** [Report Bug](https://github.com/b7s/whisper-php) • [Request Feature](https://github.com/b7s/whisper-php/issues)

All versions of whisper-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
symfony/process Version ^6.0|^7.0|^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package b7s/whisper-php contains the following files

Loading the files please wait ...