gridwb/laravel-elevenlabs 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gridwb/laravel-elevenlabs

最新稳定版本:1.1.0

Composer 安装命令:

composer require gridwb/laravel-elevenlabs

包简介

elevenlabs.io API for Laravel

README 文档

README

Laravel ElevenLabs is a convenient wrapper for interacting with the ElevenLabs API in Laravel applications.

Table of Contents

Installation

  1. Install the package

    composer require gridwb/laravel-elevenlabs
  2. Publish the configuration file

    php artisan vendor:publish --tag="elevenlabs-config"
  3. Add environment variables

    ELEVENLABS_API_URL=https://api.elevenlabs.io
    ELEVENLABS_API_KEY=your-api-key-here
    ELEVENLABS_WEBHOOK_PATH=webhooks/elevenlabs
    ELEVENLABS_WEBHOOK_SECRET=your-webhook-secret-here

Usage

Conversations Resource

get details

Get conversation details request:

<?php

use Gridwb\LaravelElevenLabs\Facades\ElevenLabs;

$conversationId = '<string>';

$response = ElevenLabs::conversations()->getDetails($conversationId);

echo $response->agentId;
echo $response->conversationId;
echo $response->status->value;
// ...

get audio

Get conversation audio request:

<?php

use Gridwb\LaravelElevenLabs\Facades\ElevenLabs;

$conversationId = '<string>';

$response = ElevenLabs::conversations()->getAudio($conversationId);

echo $response->content; // md5

delete

Delete conversation request:

<?php

use Gridwb\LaravelElevenLabs\Facades\ElevenLabs;

$conversationId = '<string>';

ElevenLabs::conversations()->delete($conversationId);

get signed url

Get conversation signed url request:

<?php

use Gridwb\LaravelElevenLabs\Facades\ElevenLabs;

$agentId = '<string>';

$response = ElevenLabs::conversations()->getSignedUrl($agentId);

echo $response->signedUrl;

get token

Get conversation token request:

<?php

use Gridwb\LaravelElevenLabs\Facades\ElevenLabs;

$agentId = '<string>';

$response = ElevenLabs::conversations()->getToken($agentId);

echo $response->token;

Webhooks

ElevenLabs can send events to your Laravel application via webhooks. By default, all webhook requests are dispatched to the Gridwb\LaravelElevenLabs\Jobs\ProcessWebhook::class job, which triggers corresponding Laravel events. You can listen to these events like any other Laravel event:

<?php

use Gridwb\LaravelElevenLabs\Events\SubscriptionStarted;
use Illuminate\Support\Facades\Event;

Event::listen(PostCallTranscription::class, function (PostCallTranscription $event) {
    $payload = $event->payload;
    // Access data from ElevenLabs payload
});

If you need custom handling, you can define your own job and set it in the config/elevenlabs.php:

<?php

return [
    'webhook' => [
        'process_webhook_job' => \Gridwb\LaravelElevenLabs\Jobs\ProcessWebhook::class,
    ],
];

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

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

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-06