1. Go to this page and download the library: Download udayshi/php-alexa library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
udayshi / php-alexa example snippets
$obj=new \USAlexa\Alexa();
#Define function to handle request
function launchIntentHandlerPhp(\USAlexa\Alexa $obj){
$obj->response->setResponse('Hello From PHP USAlexa.');
}
#Register intent and run
$obj->registerIntentHandler('LaunchRequest','launchIntentHandlerPhp')
->run();
$obj=new \USAlexa\Alexa();
#Define function to handle request
function launchIntentHandlerPhp(\USAlexa\Alexa $obj){
$obj->response->setResponse('Hello From PHP USAlexa.')
#Auto detect and send ssml
$obj->response->setWhisper('Hello')
->setBreak(2)
->setEmphasisStrong('Strong')
->setEmphasisModerate('Moderate')
->setEmphasisReduced('Reduced')
->setSayAs('TEST');
;
}
#Register intent and run
$obj->registerIntentHandler('LaunchRequest','launchIntentHandlerPhp')
->run();
$obj=new \USAlexa\Alexa();
#Define function to handle request
function launchIntentHandlerPhp(\USAlexa\Alexa $obj){
$obj->response->setResponse('Hello From PHP USAlexa for echo show.')
#Autodetect
$img=$obj->getImageObject('[[IMG_URL]]');
$obj->template->setBackgroundImage($img);
$img=$obj->getImageObject('[[IMG_URL]]');
$obj->template->setImage($img);
;
}
#Register intent and run
$obj->registerIntentHandler('LaunchRequest','launchIntentHandlerPhp')
->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.