A Laravel package for integrating Deepgram’s AI voice services
dij-digital/deepgram-laravel is a Laravel package for a laravel package for integrating deepgram’s ai voice services.
It currently has 7 GitHub stars and 2.332 downloads on Packagist (latest version 0.1.3).
Install it with composer require dij-digital/deepgram-laravel.
Discover more Laravel packages by dij-digital
or browse all Laravel packages to compare alternatives.
Last updated
This package provides a seamless integration with Deepgram's AI voice services. Built following Laravel conventions.
Requires PHP 8.3 or higher and Laravel 12+
⚡️ Install the package using Composer:
composer require dij-digital/deepgram-laravel
Publish the config file:
php artisan vendor:publish --tag="deepgram-laravel-config"
Add your Deepgram API credentials to your .env file:
DEEPGRAM_API_KEY=your-api-key-here
DEEPGRAM_BASE_URL=https://api.deepgram.com/v1
DEEPGRAM_DEFAULT_MODEL=nova-2
DEEPGRAM_DEFAULT_LANGUAGE=en-US
use DIJ\Deepgram\Facades\Deepgram;
// Basic transcription with config defaults
$result = Deepgram::listen()->transcribeFile('/path/to/audio.wav', 'audio/wav');
// With custom options per call
$result = Deepgram::listen()->transcribeFile('/path/to/audio.wav', 'audio/wav', [
'model' => 'nova-3',
'language' => 'en',
'smart_format' => true,
'punctuate' => true,
'diarize' => true,
]);
The published config file (config/deepgram-laravel.php) contains the following options:
return [
'api_key' => env('DEEPGRAM_API_KEY'),
'base_url' => env('DEEPGRAM_BASE_URL', 'https://api.deepgram.com/v1'),
'default_model' => env('DEEPGRAM_DEFAULT_MODEL', 'nova-2'),
'default_language' => env('DEEPGRAM_DEFAULT_LANGUAGE', 'nl'),
];
When testing your application, you can use Deepgram::fake() to prevent real HTTP calls to the Deepgram API:
use DIJ\Deepgram\Facades\Deepgram;
it('can process audio files', function () {
// Prevent real API calls
Deepgram::fake();
// Your application code - no real HTTP calls will be made
$result = Deepgram::listen()->transcribeFile('/path/to/audio.wav');
// Returns fake transcription data for testing
expect($result)->toBeArray()->toHaveKey('results');
});
The fake will return realistic fake transcription data so your tests can run without hitting the actual Deepgram API.
You can also use Laravel's standard facade mocking methods, like Deepgram::shouldReceive()->once()->andReturn() for more precise control if needed.
Deepgram Laravel was created by DIJ Digital under the MIT license.