DEPRECATED PHP skeleton application for Amazon Alexa Skills based on Zend\Expressive
This project is deprecated. Please move to https://github.com/phoice/phlexa-expressive-skeleton
With this PHP skeleton application you can easily setup your own PHP based Amazon Alexa skills.
This skeleton application is built with Zend\Expressive
. For further details about the
Zend\Expressive
micro-framework please refer to the official docs.
Create a new project based on the skeleton application simply with Composer:
composer create-project travello-gmbh/amazon-alexa-skill-skeleton name-of-your-project
Zend\Expressive
application setup for you to handle requests from Amazon Alexa andHelloIntent
toFor further details please refer to the docs.
To get your skill running with PHP you need to setup your server which supports PHP 7. Install the application and setup a SSL Certificate. For further details please refer to the docs.
If you have setup your server you can test the Hello
example skill with the following
URL: https://your.server.com/hello/
Just sent a POST request (for example with Postman) with these headers:
Content-Type: application/json
signaturecertchainurl : https://s3.amazonaws.com/echo.api/echo-api-cert-4.pem
signature: B/bxAdkIabkzsScfUsSfkz7pJrNLc1eoOOLk8qwG1ZudQRv7KcvyNa/91g74Zg3cRpifXEco4669MaZb4Cqs+vZ9TaTfftAMzy/Pc79AMuf1dU6GfUU7tp6cuavfqTD8cWlYN5TjEMCJbS1Y+VU929mX0edOZcZin7db6bOoZHu5gU8OSQ2r+6UMk88z5uuSjPyt9Du9vaC3Ics/Br30fEIplIgCt4y/UGRK76Rqo4L/DuNjty3o2mcU8bICK5xfZwCeH7b5UFwdjngtp8VfhKPtosZmCuWvMn+y9HoS06ll9cdI1FPLN9w7KwMZFY8UzTc+0GfAwntxzlowAwkPhQ==
To simulate the launch of the skill use this body:
{
"session": {
"sessionId": "SessionId.test",
"application": {
"applicationId": "amzn1.ask.skill.place-your-skill-id-here"
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account.test"
},
"new": true
},
"request": {
"type": "LaunchRequest",
"requestId": "EdwRequestId.test",
"locale": "de-DE",
"timestamp": "2017-01-26T20:38:55Z"
},
"version": "1.0"
}
And to test the HelloIntent
use this body:
{
"session": {
"sessionId": "SessionId.test",
"application": {
"applicationId": "amzn1.ask.skill.place-your-skill-id-here"
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account.test"
},
"new": true
},
"request": {
"type": "IntentRequest",
"requestId": "EdwRequestId.test",
"locale": "de-DE",
"timestamp": "2017-01-27T20:29:59Z",
"intent": {
"name": "HelloIntent",
"slots": {}
}
},
"version": "1.0"
}
Have a closer look at these configuration files for activating the signature validation and the request logging feature.
/config/autoload/travello-alexa.config.global.php
/config/autoload/travello-alexa.config.development.php