PHP code example of ampedradio / alexa-streaming-php

1. Go to this page and download the library: Download ampedradio/alexa-streaming-php 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/ */

    

ampedradio / alexa-streaming-php example snippets


use AmpedRadio\AlexaStreamingPHP\AlexaStreaming;
use AmpedRadio\AlexaStreamingPHP\AlexaStreamingConfig;
use Ramsey\Uuid\Uuid;

$config = new AlexaStreamingConfig();
$config->app_id = 'amzn1.ask.skill.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
$config->stream_url = 'https://<stream-url>';
$config->title = 'Amped Radio';
$config->subtitle = 'Fueling The Original Social Network';
$config->art = 'https://<domain>/art.png';
$config->background_image = 'https://<domain>/background.png';
$config->stream_token = Uuid::uuid4();

$alexa = new AlexaStreaming($config);
$response = $alexa->execute();

header('Content-Type: application/json');
echo json_encode($response);
bash
composer