PHP code example of maxbeckers / amazon-alexa-bundle

1. Go to this page and download the library: Download maxbeckers/amazon-alexa-bundle 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/ */

    

maxbeckers / amazon-alexa-bundle example snippets


return [
    // ...existing bundles...
    MaxBeckers\AmazonAlexaBundle\MaxBeckersAmazonAlexaBundle::class => ['all' => true],
];

use MaxBeckers\AmazonAlexa\Helper\SsmlGenerator;

class MyService
{
    public function __construct(
        private readonly SsmlGenerator $ssmlGenerator
    ) {
    }

    public function generateSsml(): string
    {
        // add a message
        $this->ssmlGenerator->say('Hello World');
        $ssml = $this->ssmlGenerator->getSsml();
        // $ssml === '<speak>Hello World</speak>'
        
        return $ssml;
    }
}

$ssmlGenerator = $this->container->get('maxbeckers_amazon_alexa.ssml_generator');