tacman / amazon-alexa-bundle
Symfony Bundle for amazon alexa skills, forked from maxbeckers/amazon-alexa-bundle
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 2
Type:symfony-bundle
Requires
- php: ^8.1
- maxbeckers/amazon-alexa-php: >=1.0
- symfony/config: ^6.4 || ^7.0
- symfony/dependency-injection: ^6.4 || ^7.0
- symfony/framework-bundle: ^6.4 || ^7.0
- symfony/http-foundation: ^6.4 || ^7.0
- symfony/http-kernel: ^6.4 || ^7.0
Requires (Dev)
- phpstan/phpstan: 2.0.x-dev
This package is auto-updated.
Last update: 2024-11-24 15:10:15 UTC
README
This bundle is a simlpe helper to create an Amazon Echo (Alexa) endpoint to your symfony project. You only need to add the Bundle to your project and create some handlers for the alexa requests, configured in amazon alexa backend.
Install via composer
Require the bundle via composer:
composer require maxbeckers/amazon-alexa-bundle
Enable Routing
Then add the Bundle endpoint for alexa to config/routes.yaml
.
# config/routes.yaml
maxbeckers_amazon_alexa:
path: /alexa/ # the url, the alexa endpoint should be available
defaults: { _controller: MaxBeckers\AmazonAlexaBundle\Controller\AmazonAlexa::amazonRequest }
Create handlers
To add Handlers for alexa, create them as a service and tag them with maxbeckers_amazon_alexa.request_handler
.
How to create a handler see maxbeckers/amazon-alexa-php.
services:
example.my_handler:
class: Example\MyIntentHandler
arguments:
- '@maxbeckers_amazon_alexa.response_helper' # ResponseHelper
tags:
- 'maxbeckers_amazon_alexa.request_handler'
Generate ssml
For ssml use the maxbeckers_amazon_alexa.ssml_generator
service to create valid ssml.
$ssmlGenerator = $this->get('maxbeckers_amazon_alexa.ssml_generator'); // add a message $ssmlGenerator->say('Hallo World'); $ssml = $ssmlGenerator->getSsml(); // $ssml === '<speak>Hallo World</speak>'
Development
composer config repositories.tacman_alexa '{"type": "path", "url": "/home/tac/g/tacman/amazon-alexa-bundle"}' composer req tacman/amazon-alexa-bundle:*@dev