PHP code example of ang3 / aws-polly-bundle

1. Go to this page and download the library: Download ang3/aws-polly-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/ */

    

ang3 / aws-polly-bundle example snippets


namespace App\Service;

use Aws\Polly\PollyClient;

class MyService
{
    public function __construct(private PollyClient $client)
    {
    }
}

namespace App\Service;

use Ang3\Bundle\AwsBundle\Service\SpeechSynthesizer;

class MyService
{
    public function __construct(private SpeechSynthesizer $speechSynthesizer)
    {
    }
}

use Ang3\Bundle\AwsPollyBundle\Enum\Voice;

/** @var \Ang3\Bundle\AwsBundle\Service\SpeechSynthesizer $speechSynthesizer */

$audioFileUrl = $speechSynthesizer->create('Hello world!', Voice::AMY);