PHPackages                             bitsoftsol/laravel-vibevoice - 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. [API Development](/categories/api)
4. /
5. bitsoftsol/laravel-vibevoice

ActiveLibrary[API Development](/categories/api)

bitsoftsol/laravel-vibevoice
============================

Laravel package for Microsoft VibeVoice AI voice synthesis integration

00PHP

Since Dec 11Pushed 5mo agoCompare

[ Source](https://github.com/hafizSiddiq7675/laravel-vibevoice)[ Packagist](https://packagist.org/packages/bitsoftsol/laravel-vibevoice)[ RSS](/packages/bitsoftsol-laravel-vibevoice/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel VibeVoice
=================

[](#laravel-vibevoice)

[![Latest Version on Packagist](https://camo.githubusercontent.com/de824d4d66e5c9cc70125b2705af6b22ba8ade3f302d3cd028f07342ed5e9eec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626974736f6674736f6c2f6c61726176656c2d76696265766f6963652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bitsoftsol/laravel-vibevoice)[![Total Downloads](https://camo.githubusercontent.com/ce14a62404cd6c89515fe050f6f67898b578327bb5b660f6da885b1cf6d3ff9c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626974736f6674736f6c2f6c61726176656c2d76696265766f6963652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bitsoftsol/laravel-vibevoice)[![License](https://camo.githubusercontent.com/52a99fa94467a59145f46bb58f39fa1926055be716f6e958dced3123ebf92b67/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f626974736f6674736f6c2f6c61726176656c2d76696265766f6963652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bitsoftsol/laravel-vibevoice)

A Laravel package for integrating Microsoft's VibeVoice AI voice synthesis technology. Generate high-quality, multi-speaker text-to-speech audio in your Laravel applications.

Features
--------

[](#features)

- Single speaker text-to-speech generation
- Multi-speaker conversation synthesis (up to 4 speakers)
- Real-time streaming audio generation
- Eloquent model integration via trait
- Asynchronous audio generation via Laravel queues
- Configurable storage (local, S3, etc.)
- Artisan commands for CLI usage

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

[](#requirements)

- PHP 8.1+
- Laravel 10.x or 11.x
- A running VibeVoice API server (see [vibevoice-api](https://github.com/bitsoftsol/vibevoice-api))

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

[](#installation)

Install the package via Composer:

```
composer require bitsoftsol/laravel-vibevoice
```

Publish the configuration file:

```
php artisan vendor:publish --tag=vibevoice-config
```

Add the following environment variables to your `.env` file:

```
VIBEVOICE_API_URL=http://your-api-server:8000
VIBEVOICE_API_KEY=your-api-key
VIBEVOICE_DEFAULT_VOICE=en-US-female-1
```

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

[](#quick-start)

### Basic Usage

[](#basic-usage)

```
use BitsoftSol\VibeVoice\Facades\VibeVoice;

// Generate audio from text
$result = VibeVoice::generate('Hello, welcome to our application!');

// Access the audio content
$audioContent = $result->getAudioContent();
$duration = $result->duration; // in seconds

// Generate and save to storage
$path = VibeVoice::generateAndSave('Hello world!', 'greeting');
// Returns: vibevoice/greeting.mp3
```

### Using a Specific Voice

[](#using-a-specific-voice)

```
// List available voices
$voices = VibeVoice::voices();

foreach ($voices as $voice) {
    echo "{$voice->id}: {$voice->name} ({$voice->gender})\n";
}

// Generate with a specific voice
$result = VibeVoice::generate('Hello!', 'en-US-male-1');
```

### Multi-Speaker Conversations

[](#multi-speaker-conversations)

```
use BitsoftSol\VibeVoice\DTOs\ConversationLine;

$conversation = [
    new ConversationLine(text: 'Hello, how can I help you today?', voice: 'en-US-female-1', speaker: 'Agent'),
    new ConversationLine(text: 'I have a question about my order.', voice: 'en-US-male-1', speaker: 'Customer'),
    new ConversationLine(text: 'Of course! Let me look that up for you.', voice: 'en-US-female-1', speaker: 'Agent'),
];

$result = VibeVoice::conversation($conversation);

// Or using arrays
$conversation = [
    ['text' => 'Hello!', 'voice' => 'en-US-female-1'],
    ['text' => 'Hi there!', 'voice' => 'en-US-male-1'],
];

$path = VibeVoice::conversationAndSave($conversation, 'dialogue');
```

### Streaming Audio

[](#streaming-audio)

```
// Stream audio chunks in real-time
foreach (VibeVoice::stream('This is a long text to stream...') as $chunk) {
    // Process each audio chunk
    echo $chunk;
}
```

Model Integration
-----------------

[](#model-integration)

Add text-to-speech capabilities to your Eloquent models using the `HasVoiceContent` trait.

### Migration

[](#migration)

```
Schema::create('articles', function (Blueprint $table) {
    $table->id();
    $table->string('title');
    $table->text('content');
    $table->string('audio_file')->nullable();
    $table->float('audio_duration')->nullable();
    $table->string('voice_id')->nullable();
    $table->timestamps();
});
```

### Model Setup

[](#model-setup)

```
use BitsoftSol\VibeVoice\Traits\HasVoiceContent;
use Illuminate\Database\Eloquent\Model;

class Article extends Model
{
    use HasVoiceContent;

    protected $fillable = ['title', 'content', 'voice_id'];

    // Specify which field contains the text to convert
    public function getVoiceTextField(): string
    {
        return 'content';
    }

    // Optionally specify a default voice for this model
    public function getVoiceId(): ?string
    {
        return $this->voice_id ?? 'en-US-female-1';
    }
}
```

### Usage

[](#usage)

```
$article = Article::create([
    'title' => 'My Article',
    'content' => 'This is the article content that will be converted to speech.',
]);

// Generate audio synchronously
$article->generateAudio();

// Generate audio asynchronously via queue
$article->generateAudioAsync();

// Check if audio exists
if ($article->hasAudio()) {
    $url = $article->getAudioUrl();
    $duration = $article->getFormattedAudioDuration(); // "02:30.50"
}

// Regenerate audio (deletes old file and creates new)
$article->regenerateAudio();

// Delete audio file
$article->deleteAudio();
```

Async Processing
----------------

[](#async-processing)

### Queue Jobs

[](#queue-jobs)

```
use BitsoftSol\VibeVoice\Facades\VibeVoice;

// Generate audio in background
VibeVoice::generateAsync('Long text to process...', 'en-US-female-1', 'output-file');

// Generate conversation in background
VibeVoice::conversationAsync($lines, 'conversation-output');
```

### Events

[](#events)

Listen for audio generation events:

```
// In EventServiceProvider or event listener
use BitsoftSol\VibeVoice\Events\VoiceGenerated;
use BitsoftSol\VibeVoice\Events\VoiceGenerationFailed;

Event::listen(VoiceGenerated::class, function ($event) {
    $path = $event->path;
    $duration = $event->result->duration;

    // Update related model if available
    if ($model = $event->getModel()) {
        // Model was updated automatically
    }
});

Event::listen(VoiceGenerationFailed::class, function ($event) {
    Log::error('Voice generation failed', [
        'error' => $event->getErrorMessage(),
        'text' => $event->text,
    ]);
});
```

Artisan Commands
----------------

[](#artisan-commands)

### Generate Audio

[](#generate-audio)

```
# Generate audio from text
php artisan vibevoice:generate "Hello, this is a test!"

# Specify voice and output file
php artisan vibevoice:generate "Hello!" --voice=en-US-male-1 --output=greeting

# Generate asynchronously
php artisan vibevoice:generate "Hello!" --async
```

### List Voices

[](#list-voices)

```
# List all available voices
php artisan vibevoice:voices

# Filter by language or gender
php artisan vibevoice:voices --language=en-US --gender=female

# Output as JSON
php artisan vibevoice:voices --json
```

### Test Connection

[](#test-connection)

```
# Basic connection test
php artisan vibevoice:test

# Full test including audio generation
php artisan vibevoice:test --full
```

Configuration
-------------

[](#configuration)

```
// config/vibevoice.php

return [
    'api' => [
        'base_url' => env('VIBEVOICE_API_URL', 'http://localhost:8000'),
        'key' => env('VIBEVOICE_API_KEY'),
        'timeout' => env('VIBEVOICE_TIMEOUT', 120),
        'connect_timeout' => env('VIBEVOICE_CONNECT_TIMEOUT', 10),
    ],

    'default_voice' => env('VIBEVOICE_DEFAULT_VOICE', 'en-US-female-1'),

    'audio' => [
        'format' => env('VIBEVOICE_AUDIO_FORMAT', 'mp3'),
        'sample_rate' => env('VIBEVOICE_SAMPLE_RATE', 24000),
        'bitrate' => env('VIBEVOICE_BITRATE', 128),
    ],

    'storage' => [
        'disk' => env('VIBEVOICE_STORAGE_DISK', 'public'),
        'path' => env('VIBEVOICE_STORAGE_PATH', 'vibevoice'),
    ],

    'queue' => [
        'connection' => env('VIBEVOICE_QUEUE_CONNECTION'),
        'queue' => env('VIBEVOICE_QUEUE_NAME', 'default'),
    ],

    'streaming' => [
        'enabled' => env('VIBEVOICE_STREAMING_ENABLED', true),
        'chunk_size' => env('VIBEVOICE_CHUNK_SIZE', 4096),
    ],

    'cache' => [
        'enabled' => env('VIBEVOICE_CACHE_ENABLED', true),
        'ttl' => env('VIBEVOICE_CACHE_TTL', 3600),
        'prefix' => 'vibevoice',
    ],

    'retry' => [
        'times' => env('VIBEVOICE_RETRY_TIMES', 3),
        'sleep' => env('VIBEVOICE_RETRY_SLEEP', 1000),
    ],
];
```

Error Handling
--------------

[](#error-handling)

The package throws specific exceptions for different error scenarios:

```
use BitsoftSol\VibeVoice\Exceptions\AuthenticationException;
use BitsoftSol\VibeVoice\Exceptions\ConnectionException;
use BitsoftSol\VibeVoice\Exceptions\GenerationException;
use BitsoftSol\VibeVoice\Exceptions\RateLimitException;

try {
    $result = VibeVoice::generate($text);
} catch (AuthenticationException $e) {
    // Invalid or missing API key
} catch (ConnectionException $e) {
    // Cannot connect to API server
} catch (RateLimitException $e) {
    $retryAfter = $e->getRetryAfter(); // seconds to wait
} catch (GenerationException $e) {
    // Invalid input or generation failed
    $context = $e->getContext();
}
```

API Reference
-------------

[](#api-reference)

### Facade Methods

[](#facade-methods)

MethodDescription`generate(string $text, ?string $voice = null): AudioResult`Generate audio from text`conversation(array $lines): AudioResult`Generate multi-speaker audio`stream(string $text, ?string $voice = null): Generator`Stream audio chunks`voices(): array`Get available voices`isHealthy(): bool`Check API health`health(): array`Get API health details`generateAndSave(string $text, ?string $filename = null, ?string $voice = null): string`Generate and save audio`generateAsync(string $text, ?string $voice = null, ?string $filename = null): void`Queue audio generation### HasVoiceContent Trait Methods

[](#hasvoicecontent-trait-methods)

MethodDescription`generateAudio(?string $voice = null): AudioResult`Generate audio synchronously`generateAudioAsync(?string $voice = null): void`Generate audio via queue`hasAudio(): bool`Check if audio exists`getAudioUrl(): ?string`Get audio file URL`getAudioPath(): ?string`Get audio file path`deleteAudio(): bool`Delete audio file`regenerateAudio(?string $voice = null): AudioResult`Delete and regenerate audioTesting
-------

[](#testing)

```
composer test
```

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

[](#contributing)

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

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

Credits
-------

[](#credits)

- [BitsoftSol Development Team](https://github.com/bitsoftsol)
- [All Contributors](../../contributors)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance50

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

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/4de51770e8f177b9df6dabac90967eec870b695b08d533cb65285c7cf6b94e2f?d=identicon)[hafizSiddiq7675](/maintainers/hafizSiddiq7675)

---

Top Contributors

[![hafizSiddiq7675](https://avatars.githubusercontent.com/u/29893550?v=4)](https://github.com/hafizSiddiq7675 "hafizSiddiq7675 (2 commits)")

### Embed Badge

![Health badge](/badges/bitsoftsol-laravel-vibevoice/health.svg)

```
[![Health](https://phpackages.com/badges/bitsoftsol-laravel-vibevoice/health.svg)](https://phpackages.com/packages/bitsoftsol-laravel-vibevoice)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M453](/packages/google-gax)

PHPackages © 2026

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