coreylang/php-elevenlabs-ai
Composer 安装命令:
composer require coreylang/php-elevenlabs-ai
包简介
A PHP package to make calls to the ElevenLabs Conversational AI API
README 文档
README
PHP ElevenLabs AI
PHP ElevenLabs AI is a PHP library to make calls to the ElevenLabs Conversational AI API.
PHP ElevenLabs AI's current focus is the Conversational AI API. In the future we will focus on the other APIs. The current release has calls to Twilo, SIP Trunk, Conversations, Tools, and Batch Calling APIs.
Need Help?
Email me coreylang.dev@gmail.com
Install
The recommended way to install PHP ElevenLabs AI is through Composer.
composer require coreylang/php-elevenlabs-ai
Twilio
Make Outbound Call Example
Handle an outbound call via Twilio
<?php require __DIR__ . "/vendor/autoload.php"; use coreylang\ElevenLabsAI\ConversationalAI\Twilio; try { $client = new Twilio(); $client->SetAuthKey('{API_KEY}'); $params = []; // --- required $params['Agent_Id'] = "{AGENT_ID}"; $params['Agent_Phone_Number_Id'] = "{AGENT_PHONE_NUMBER_ID}"; $params['To_Phone_Number'] = "{TO_PHONE_NUMBER}"; // --- optional $params['Intiation_Prompt'] = "{PROMPT_TEXT}"; $params['Initiation_First_Message'] = "{FIRST_MESSAGE_TEXT}"; $params['Initiation_Language'] = "{LANGUAGE_CODE}"; // english -> 'en' $params['Initiation_Voice_Id'] = "{VOICE_ID}"; $params['Initiation_Native_MCP_Server_Ids'] = ['{MCP_Server_Id}']; $params['Initiation_Custom_LLM_Extra_Body'] = "{Custom_LLM_EXtra_Body_Text}"; $params['Initiation_User_Id'] = "{Custom_User_Id}"; $params['Initiation_Source'] = "{Application_Source_Name}"; $params['Initiation_Version'] = "{Application_Version}"; $params['Initiation_Dynamic_Variables'] = array( 'first_name' => 'Corey Lang' ); $result = $client->MakeOutboundCall($params); } catch(Exception $e) { echo $e->getMessage(); }
SIP Trunk
Make Outbound Call Example
Handle an outbound call via SIP trunk
<?php require __DIR__ . "/vendor/autoload.php"; use coreylang\ElevenLabsAI\ConversationalAI\SIPTrunk; try { $client = new SIPTrunk(); $client->SetAuthKey('{API_KEY}'); $params = []; // --- required $params['Agent_Id'] = "{AGENT_ID}"; $params['Agent_Phone_Number_Id'] = "{AGENT_PHONE_NUMBER_ID}"; $params['To_Phone_Number'] = "{TO_PHONE_NUMBER}"; // --- optional $params['Intiation_Prompt'] = "{PROMPT_TEXT}"; $params['Initiation_First_Message'] = "{FIRST_MESSAGE_TEXT}"; $params['Initiation_Language'] = "{LANGUAGE_CODE}"; // english -> 'en' $params['Initiation_Voice_Id'] = "{VOICE_ID}"; $params['Initiation_Native_MCP_Server_Ids'] = ['{MCP_Server_Id}']; $params['Initiation_Custom_LLM_Extra_Body'] = "{Custom_LLM_EXtra_Body_Text}"; $params['Initiation_User_Id'] = "{Custom_User_Id}"; $params['Initiation_Source'] = "{Application_Source_Name}"; $params['Initiation_Version'] = "{Application_Version}"; $params['Initiation_Dynamic_Variables'] = array( 'first_name' => 'Corey Lang' ); $result = $client->MakeOutboundCall($params); } catch(Exception $e) { echo $e->getMessage(); }
Conversations
Get Conversation Details Example
Get the details of a particular conversation
<?php require __DIR__ . "/vendor/autoload.php"; use coreylang\ElevenLabsAI\ConversationalAI\Conversations; $conversationId = "{CONVERSATION_ID}"; try { $client = new Conversations(); $client->SetAuthKey({API_KEY}); $conversation = $client->GetConversationDetails($conversationId); } catch(Exception $e) { echo $e->getMessage(); }
Get Conversation Audio Example
Get the audio recording of a particular conversation
<?php require __DIR__ . "/vendor/autoload.php"; use coreylang\ElevenLabsAI\ConversationalAI\Conversations; $conversationId = "{CONVERSATION_ID}"; try { $client = new Conversations(); $client->SetAuthKey('{API_KEY}'); $audio = $client->GetConversationAudio($conversationId); } catch(Exception $e) { echo $e->getMessage(); }
Delete Conversation Example
Delete a particular conversation
<?php require __DIR__ . "/vendor/autoload.php"; use coreylang\ElevenLabsAI\ConversationalAI\Conversations; $conversationId = "{CONVERSATION_ID}"; try { $client = new Conversations(); $client->SetAuthKey('{API_KEY}'); $result = $client->DeleteConversation($conversationId); } catch(Exception $e) { echo $e->getMessage(); }
Get Signed URL Example
Get a signed url to start a conversation with an agent with an agent that requires authorization
<?php require __DIR__ . "/vendor/autoload.php"; use coreylang\ElevenLabsAI\ConversationalAI\Conversations; $agent_id = "{AGENT_ID}"; try { $client = new Conversations(); $client->SetAuthKey('{API_KEY}'); $result = $client->GetSignedURL($agent_id); } catch(Exception $e) { echo $e->getMessage(); }
Get Conversation Token Example
Get a WebRTC session token for real-time communication
<?php require __DIR__ . "/vendor/autoload.php"; use coreylang\ElevenLabsAI\ConversationalAI\Conversations; $agent_id = "{AGENT_ID}"; $participantName = "{PARTICIPANT_NAME}"; try { $client = new Conversations(); $client->SetAuthKey('{API_KEY}'); $result = $client->GetSignedURL($agent_id, $participantName); } catch(Exception $e) { echo $e->getMessage(); }
Send Conversation Feedback Example
Send the feedback for the given conversation
<?php require __DIR__ . "/vendor/autoload.php"; use coreylang\ElevenLabsAI\ConversationalAI\Conversations; $conversation_id = "{CONVERSATION_ID}"; $feedback = "like"; // either 'like' or 'dislike' try { $client = new Conversations(); $client->SetAuthKey('{API_KEY}'); $result = $client->SendConversationFeedback($conversation_id, $feedback); } catch(Exception $e) { echo $e->getMessage(); }
List Conversations Example
Get all conversations of agents that user owns. With option to restrict to a specific agent.
<?php require __DIR__ . "/vendor/autoload.php"; use coreylang\ElevenLabsAI\ConversationalAI\Conversations; // each option is optional $options = [ 'cursor' => '{CURSOR_STRING}', 'agent_id' => '{AGENT_ID}', 'call_successful' => '{CALL_SUCCESSFUL}', // success, failure, or unknown 'call_start_before_unix' => '{CALL_START_BEFORE_UNIX_TIMESTAMP}', 'call_start_after_unix' => '{CALL_START_AFTER_UNIX_TIMESTAMP}', 'user_id' => '{USER_ID}', 'page_size' => '{PAGE_SIZE_INTEGER}', // >=1, <=100 defaults to 30 'summary_mode' => '{SUMMARY_MODE}', // either exclude, or include ] try { $client = new Conversations(); $client->SetAuthKey('{API_KEY}'); $result = $client->SendConversationFeedback($options); } catch(Exception $e) { echo $e->getMessage(); }
Tools
Create tool
Add a new tool to the available tools in the workspace.
<?php require __DIR__ . "/vendor/autoload.php"; use coreylang\ElevenLabsAI\ConversationalAI\Tools; try { $client = new Tools(); $client->SetAuthKey('{API_KEY}'); $params = []; $params['tool_config'] = [ 'name' => 'Test_Webhook_Tool', 'description' => 'A test tool created by the API', 'api_schema' => [ 'url' => 'https://coreylang.dev/AI/TestToolCreatedByAPI', 'method' => 'GET', ], 'type' => 'webhook' ]; // $params['tool_config'] = [ // 'name' => 'Test_Client_Tool', // 'description' => 'A test tool created by the API', // 'type' => 'client' // ]; // $params['tool_config'] = [ // 'name' => 'end_call', // 'description' => 'A test system tool created by the API', // 'params' => ['system_tool_type' => 'end_call'], // 'type' => 'system' // ]; $result = $client->CreateTool($params); } catch(Exception $e) { echo $e->getMessage(); }
Get tool
Get tool that is available in the workspace.
<?php require __DIR__ . "/vendor/autoload.php"; use coreylang\ElevenLabsAI\ConversationalAI\Tools; try { $client = new Tools(); $client->SetAuthKey('{API_KEY}'); $tool_id = "{TOOL_ID}"; $result = $client->GetTool($tool_id); } catch(Exception $e) { echo $e->getMessage(); }
Delete tool
Delete tool from the workspace.
<?php require __DIR__ . "/vendor/autoload.php"; use coreylang\ElevenLabsAI\ConversationalAI\Tools; try { $client = new Tools(); $client->SetAuthKey('{API_KEY}'); $tool_id = "{TOOL_ID}"; $result = $client->DeleteTool($tool_id); } catch(Exception $e) { echo $e->getMessage(); }
Update tool
Update tool that is available in the workspace.
<?php require __DIR__ . "/vendor/autoload.php"; use coreylang\ElevenLabsAI\ConversationalAI\Tools; try { $client = new Tools(); $client->SetAuthKey('{API_KEY}'); $toolOptions = []; $toolOptions['tool_config'] = [ 'name' => 'Test_Webhook_Tool', 'description' => 'A test tool created by the API', 'api_schema' => [ 'url' => 'https://coreylang.dev/AI/TestToolCreatedByAPI', 'method' => 'GET', ], 'type' => 'webhook' ]; // $toolOptions['tool_config'] = [ // 'name' => 'Test_Client_Tool', // 'description' => 'A test tool created by the API', // 'type' => 'client' // ]; // $toolOptions['tool_config'] = [ // 'name' => 'end_call', // 'description' => 'A test system tool created by the API', // 'params' => ['system_tool_type' => 'end_call'], // 'type' => 'system' // ]; $result = $client->UpdateTool($toolId, $toolOptions); } catch(Exception $e) { echo $e->getMessage(); }
Get dependent agents
Get a list of agents depending on this tool
<?php require __DIR__ . "/vendor/autoload.php"; use coreylang\ElevenLabsAI\ConversationalAI\Tools; try { $client = new Tools(); $client->SetAuthKey('{API_KEY}'); $tool_id = "{TOOL_ID}"; $result = $client->GetDependentAgents($tool_id); } catch(Exception $e) { echo $e->getMessage(); }
Submit Batch calling job
Submit a batch call request to schedule calls for multiple recipients.
<?php require __DIR__."/vendor/autoload.php" use coreylang\ElevenLabsAI\ConversationalAI\BatchCalling; try { $client = new BatchCalling(); $client->SetAuthKey('{API_KEY}'); $params = []; $params['call_name'] = "{CALL_NAME}"; $params['agent_id'] = "{AGENT_ID}"; $params['agent_phone_number_id'] = "{AGENT_PHONE_NUMBER_ID}"; $params['scheduled_time_unix'] = "{UNIX_TIME_STAMP}"; $params['recipients'] = []; $params['recipients']['phone_number'] = "{PHONE_NUMBER}"; $params['recipients']['id'] = "{CUSTOM_ID}"; $params['recipients']['conversation_initiation_client_data'] = [ 'conversation_config_override' => [ "agent" => [ 'first_message' => "{FIRST_MESSAGE_TEXT}", 'language' => "{LANGUAGE_CODE}", 'prompt' => "{PROMPT_TEXT}" ], "conversation" => [ 'text_only' => "{true or false}" ], "tts" => [ 'voice_id' => "{VOICE_ID}" ] ], 'custom_llm_extra_body' => "{CUSTOM_LLM_TEXT}", 'user_id' => "{USER_ID}", 'source_info' => [ 'source' => 'unknown', 'version' => '{VERSION_NUMBER}' ] ]; $result = $client->SubmitBatchCallingJob($params); } catch(Exception $e) { echo $e->getMessage(); }
coreylang/php-elevenlabs-ai 适用场景与选型建议
coreylang/php-elevenlabs-ai 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 08 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「ai」 「Conversational AI」 「elevenlabs」 「elevenlabs ai」 「php elevenlabs」 「conversational」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 coreylang/php-elevenlabs-ai 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 coreylang/php-elevenlabs-ai 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 coreylang/php-elevenlabs-ai 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP library for interacting with AI platform provider.
ElevenLabs platform bridge for Symfony AI
ElevenLabs API client
Alfabank REST API integration
A Laravel package for the ElevenLabs Voice API — text-to-speech, speech-to-text, and sound effects.
Upgrade Laravel Telegram bots with AI-powered ChatGPT. Create engaging, lifelike conversations effortlessly
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-11