mesilov/yandex-dialogs-php-sdk
Composer 安装命令:
composer require mesilov/yandex-dialogs-php-sdk
包简介
Yandex dialogs API PHP-wrapper
README 文档
README
Репозиторий PHP-библиотеки для облегчения работы с диалогами
Пример использования
// получаем входящий API-запрос $apiRequestArray = json_decode(trim(file_get_contents('php://input')), true); $dialogRequest = Yandex\Dialogs\Webhook\Request\Fabric::initFromArray($apiRequestArray); $responseFabric = new Yandex\Dialogs\Webhook\Response\Fabric($dialogRequest); $button1 = new Yandex\Dialogs\Webhook\Response\DTO\Buttons\Button(); $button1 ->setTitle('Кнопка1') ->setUrl('https://ya.ru'); $button2 = new Yandex\Dialogs\Webhook\Response\DTO\Buttons\Button(); $button2 ->setTitle('Кнопка2'); $response = $responseFabric ->setText('Привет') ->setTts('Привет') ->addButton($button1) ->addButton($button2) ->buildResponse(); header('Content-Type: application/json'); print(json_encode(Yandex\Dialogs\Webhook\Response\Formatters\Formatter::toArray($response), JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT));
统计信息
- 总下载量: 324
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 26
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-03-13