定制 udayshi/php-alexa 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

udayshi/php-alexa

Composer 安装命令:

composer require udayshi/php-alexa

包简介

This is PHP Helper library for Alexa and Echo Show to generate response with few lines of code.

README 文档

README

This is PHP Helper library for Alexa and Echo Show to generate response with few lines of code..

Install via composer

Require the package with composer:

composer require udayshi/usalexa

Usage

Quick Implement

Just to send PlainText Quick response you can create function with any name and pass \USAlexa\Alexa $obj as parameter on created function.

Once you create the function you have to map and register the method.

Finally you can run it.

    require('./vendor/autoload.php');
    $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();
    

more...

Adding Effects

You can add the following effects:

  • Whisper
  • Break
  • Emphasis
    • Strong
    • Moderate
    • Reduced
  • SayAs
    require('./vendor/autoload.php');
    $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();
    

Echo Show Response

As long as you have minimum parameter for the echo show it will send proper response to the targeted devices.

    require('./vendor/autoload.php');
    $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();
    

more...

统计信息

  • 总下载量: 3.44k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固