2017 © Pedro Peláez
 

library amazon-alexa-php

Amazon Alexa interface for PHP

image

gruessung/amazon-alexa-php

Amazon Alexa interface for PHP

  • Thursday, July 20, 2017
  • by gruessung
  • Repository
  • 1 Watchers
  • 1 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 67 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

Amazon Alexa PHP Library

Changes (reasons for fork)

  • verifiying timestamp automatically
  • change timestamp verification to current certification guidelines

This library provides provides a convient interface for developing Amazon Alexa Skills for your PHP app., (*1)

Usage

Install via composer: composer require gruessung/amazon-alexa-php., (*2)

Requests

When Amazon Alexa triggers your skill, a HTTP request will be sent to the URL you specified for your app., (*3)

You can parse the JSON body of the request like so:, (*4)

$jsonDataAsArray = $request->json()->all(); // This is how you would retrieve this with Laravel
$alexaRequest = \Alexa\Request\Request::fromData($jsonDataAsArray);

You can determine the type of the request with instanceof, e.g.:, (*5)

if ($alexaRequest instanceof IntentRequest) {
    // Handle intent here
}

Response

You can build an Alexa response with the Response class. You can optionally set a card or a reprompt too., (*6)

Here's a few examples., (*7)

$response = new \Alexa\Response\Response;
$response->respond('Cooool. I\'ll lower the temperature a bit for you!')
    ->withCard('Temperature decreased by 2 degrees');
$response = new \Alexa\Response\Response;
$response->respond('What is your favorite color?')
    ->reprompt('Please tell me your favorite color');

To output the response, simply use the ->render() function, e.g. in Laravel you would create the response like so:, (*8)

return response()->json($response->render());

In vanilla PHP:, (*9)

header('Content-Type: application/json');
echo json_encode($response->render());
exit;

TODO

  • Verify request timestamp integrity automatically

The Versions

20/07 2017

dev-master

9999999-dev

Amazon Alexa interface for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Mathias Hansen
by Alexander Grüßung

29/11 2015

0.1.5

0.1.5.0

Amazon Alexa interface for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Mathias Hansen

29/11 2015

0.1.4

0.1.4.0

Amazon Alexa interface for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Mathias Hansen

27/10 2015

0.1.3

0.1.3.0

Amazon Alexa interface for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Mathias Hansen

02/10 2015

0.1.2

0.1.2.0

Amazon Alexa interface for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Mathias Hansen

29/09 2015

0.1.1

0.1.1.0

Amazon Alexa interface for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Mathias Hansen

20/09 2015

0.1.0

0.1.0.0

Amazon Alexa interface for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Mathias Hansen

27/08 2015

0.0.2

0.0.2.0

Amazon Alexa interface for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Mathias Hansen

26/08 2015

0.0.1

0.0.1.0

Amazon Alexa interface for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Mathias Hansen