PHPackages                             realhood/assemblyai-realtime - 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. realhood/assemblyai-realtime

ActiveLibrary

realhood/assemblyai-realtime
============================

PHP package for AssemblyAI real-time streaming with Lemur support

01[1 PRs](https://github.com/realhood/assemblyai-realtime-php/pulls)PHP

Since Dec 15Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/realhood/assemblyai-realtime-php)[ Packagist](https://packagist.org/packages/realhood/assemblyai-realtime)[ RSS](/packages/realhood-assemblyai-realtime/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

AssemblyAI Real-time PHP Package
================================

[](#assemblyai-real-time-php-package)

A comprehensive PHP package for real-time transcription and Lemur integration with AssemblyAI. This package provides a robust implementation for real-time audio transcription and AI-powered analysis using AssemblyAI's WebSocket API and Lemur capabilities.

Features
--------

[](#features)

- 🎙️ Real-time audio transcription
- 🤖 Lemur AI integration for advanced analysis
- 📝 Support for multiple Lemur tasks (summarization, Q&amp;A, action items)
- 🔄 WebSocket-based streaming with automatic reconnection
- ⚡ Efficient audio processing and chunking
- 🛠️ Comprehensive error handling
- 🧪 Full test coverage

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

[](#requirements)

- PHP 7.4 or higher
- Composer
- AssemblyAI API key

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

[](#installation)

```
composer require realhood/assemblyai-realtime
```

Quick Start
-----------

[](#quick-start)

```
use AssemblyAIRealtime\Client\AssemblyAIClient;
use AssemblyAIRealtime\Config\Configuration;

// Initialize client with Lemur
$config = new Configuration([
    'lemur' => [
        'enabled' => true,
        'task' => 'summarize',
        'prompt' => 'Provide a brief summary'
    ]
]);

$client = new AssemblyAIClient('your-api-key', $config);

// Handle transcription results
$messageHandler = function($result) {
    switch ($result['type']) {
        case 'partial':
            echo "Partial: {$result['text']}\n";
            break;
        case 'final':
            echo "Final: {$result['text']}\n";
            break;
        case 'lemur':
            echo "Lemur: {$result['response']}\n";
            break;
    }
};

// Start transcription
$client->startRealTimeTranscription($messageHandler);

// Send audio data
$client->sendAudioChunk($audioData);

// Stop when done
$client->stop();
```

Advanced Usage
--------------

[](#advanced-usage)

### Audio Processing

[](#audio-processing)

```
use AssemblyAIRealtime\Utils\AudioUtils;

// Validate audio format
if (AudioUtils::validateAudioFormat($audioPath)) {
    // Get audio duration
    $duration = AudioUtils::getAudioDuration($audioPath);

    // Convert and process audio
    $chunks = AudioUtils::convertAudioToFormat($audioPath);
    foreach ($chunks as $chunk) {
        $client->sendAudioChunk($chunk);
        usleep(20000); // 20ms delay
    }
}
```

### Lemur Integration

[](#lemur-integration)

```
use AssemblyAIRealtime\Utils\LemurUtils;

// Create Lemur configuration
$lemurConfig = LemurUtils::createLemurConfig(
    'summarize',
    'Provide a detailed summary'
);

// Available Lemur tasks
$tasks = [
    'summarize',
    'question_answer',
    'action_items',
    'key_points'
];
```

### Error Handling

[](#error-handling)

```
try {
    $client->startRealTimeTranscription($handler);
} catch (AssemblyAIException $e) {
    echo "AssemblyAI Error: " . $e->getMessage();
} catch (TranscriptionException $e) {
    echo "Transcription Error: " . $e->getMessage();
} catch (LemurException $e) {
    echo "Lemur Error: " . $e->getMessage();
}
```

Testing
-------

[](#testing)

Run the test suite:

```
./vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

Credits
-------

[](#credits)

Created and maintained by [Reza Aleyasin](https://github.com/realhood).

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity18

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8c87b0e79765e4e4066e283cd60c1a0d11156498148843fbd13eb0ade6a9d9e5?d=identicon)[aleyasin](/maintainers/aleyasin)

---

Top Contributors

[![reza-aloware](https://avatars.githubusercontent.com/u/175039347?v=4)](https://github.com/reza-aloware "reza-aloware (3 commits)")

### Embed Badge

![Health badge](/badges/realhood-assemblyai-realtime/health.svg)

```
[![Health](https://phpackages.com/badges/realhood-assemblyai-realtime/health.svg)](https://phpackages.com/packages/realhood-assemblyai-realtime)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
