vasily-kartashov / alexa-skills-kit-model
Alexa Skill Kit Model
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-11-14 09:47:21 UTC
README
This is a mapping between Alexa's request and response envelopes and PHP classes. There model library doesn't do any processing and is solely responsible for mapping only.
Reading request envelope
To read a json request execute
$data = json_decode($payload, true); $envelope = RequestEnvelope::fromValue($data);
Writing response envelope
To create a json response use respective builders
$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
Use "vasily-kartashov/alexa-skills-kit-model"
ToDo
- Move to
hamlet-framework/alexa-skill-kit-model
- Rebuild repository by retrospectively generating all previous versions as well
- Add doc parser https://stackoverflow.com/questions/8504013/how-to-read-javadoc-comments-by-reflection to copy paths
- Use DateTimeImmutable as much as possible