toku/caas_sdk

v1.0 2021-10-18 04:38 UTC

This package is auto-updated.

Last update: 2024-09-19 14:47:02 UTC


README

License: MIT

Toku

文档

您可以在这里找到在线文档。

安装

您可以使用composer安装SDK

composer require toku/caas_sdk

使用以下命令重新生成已安装的类

composer dump-autoload

快速入门 - 调用处理

自动加载

如果您的PHP框架没有处理自动加载,请使用require/include自动加载。

require __DIR__ . '/vendor/autoload.php';

使用调用控制器类来形成调用处理命令

use \Toku\CaaS\V1\CallHandle\CallController;

实例

创建一个新的调用控制器实例

$ctrl = new CallController();

调用处理命令

使用调用控制器发送调用处理命令,例如PlayTTS命令。

$ctrl->PlayTTS("This is a test message", "en", "f")->Response();

您也可以发送多个命令。

$ctrl->PlayTTS("This is a test message one", "en", "f")->
       PlayTTS("This is a test message two", "en", "f")->
       Response();

示例代码

<?php

	//Require autoloading file if your framework does not handle autoloading
	require __DIR__ . '/vendor/autoload.php';
	
	//Use the call controller class to form call handle command
	use \Toku\CaaS\V1\CallHandle\CallController;

	//Create a new call controller instance
	$ctrl = new CallController();
	
	//Optional
	header('Content-Type: application/json');

	//Use the call controller to send call handle command such as PlayTTS command
	$ctrl->PlayTTS("This is a test message", "en", "f")->
	  Response();

?>