vasily-kartashov / alexa-skills-kit-model
Amazon Alexa 技能套件模型
1.24.0
2019-11-24 03:54 UTC
Requires
- php: >=7.0
Requires (Dev)
- jakub-onderka/php-parallel-lint: @stable
- phpunit/phpunit: @stable
- squizlabs/php_codesniffer: @stable
- vimeo/psalm: @stable
This package is auto-updated.
Last update: 2024-09-14 09:30:08 UTC
README
这是 Alexa 请求和响应信封与 PHP 类之间的映射。此模型库不进行任何处理,仅负责映射。
读取请求信封
要读取 JSON 请求,请执行
$data = json_decode($payload, true); $envelope = RequestEnvelope::fromValue($data);
编写响应信封
要创建 JSON 响应,请使用相应的构建器
$speech = PlainTextOutputSpeech::ofText("Plain text string to speak"); $response = Response::builder() ->withOutputSpeech($speech) ->withShouldEndSession(true) ->build(); $envelope = ResponseEnvelope::builder() ->withVersion("string") ->withResponse($response) ->build(); $payload = json_encode($envelope);
Composer
使用 "vasily-kartashov/alexa-skills-kit-model"
待办事项
- 迁移到
hamlet-framework/alexa-skill-kit-model
- 通过回溯生成所有之前的版本来重建仓库
- 添加文档解析器 https://stackoverflow.com/questions/8504013/how-to-read-javadoc-comments-by-reflection 以复制路径
- 尽可能使用 DateTimeImmutable