1. Go to this page and download the library: Download techworker/ssml 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/ */
techworker / ssml example snippets
echo $ssml = SsmlBuilder::factory()
->paragraph('My name is ')
->brk()
->text('Techworker.');
$ssml = \Techworker\Ssml\SsmlBuilder::factory();
$ssml = \Techworker\Ssml\SsmlBuilder::factory();
$ssml->paragraph('My name is ')->brk()->text('Techworker');
$ssml = \Techworker\Ssml\SsmlBuilder::factory();
// paragraph is a container element that can host children
$paragraph = $ssml->paragraph('My name is ');
// break is a leaf element, so you need to fetch it immediately
// after adding it to get the elements instance
$break = $ssml->brk()->fetch();
$ssml = \Techworker\Ssml\SsmlBuilder::factory();
// paragraph is a container element that can host children
$paragraph = $ssml->paragraph('My name is ');
// will both give you the speak element
$paragraph->up();
$paragraph->root(); // goes up to the root
echo \Techworker\Ssml\SsmlBuilder::factory();
// or
Speak::factory();
use \Techworker\Ssml\SsmlBuilder;
SsmlBuilder::factory()->audio('https://www.yourdomain.com/sound.mp3');
use \Techworker\Ssml\SsmlBuilder;
// fluent for a container
SsmlBuilder::factory()->word('ivona:VB', 'read')->attr('mode', 'silent');
// fluent for a non-container element
SsmlBuilder::factory()->brk()->fetch()->attr('duration', '100ms');
use \Techworker\Ssml\SsmlBuilder;
use \Techworker\Ssml\Specification\Alexa;
$ssml = SsmlBuilder::factory()->paragraph()->root(); //..whatever
try
{
(new Alexa)->validate($ssml);
} catch(\Techworker\Ssml\SsmlException $ex) {
// invalid
}
xml
<speak><break/></speak>
<!-- or -->
<speak><break strength="medium"/></speak>
<!-- or -->
<speak><break time="5s"/></speak>
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.