PHPackages                             cidilabs/aws-polly - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. cidilabs/aws-polly

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cidilabs/aws-polly
==================

AWS Polly Library

1.0.2(3y ago)05751MITPHPPHP &gt;=8.0

Since Nov 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/cidilabs/aws-polly)[ Packagist](https://packagist.org/packages/cidilabs/aws-polly)[ RSS](/packages/cidilabs-aws-polly/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (3)Dependencies (3)Versions (17)Used By (0)

aws-polly
=========

[](#aws-polly)

aws-polly is an integration library for the file conversion functionality of files to audio using aws polly. HTML to SSML is also included with SsmlCreator.php

Setup
-----

[](#setup)

aws-polly can be installed to your project via Composer by adding the following line to your composer.json file:

```
composer require "cidilabs/aws-polly": "dev-master"

```

`"cidilabs/aws-polly": "dev-master"`

Once aws-polly library is installed, you'll need to let UDOIT know which file conversion library you'll be using.

This can be done:

- In the .env:

```
AVAILABLE_FILE_FORMATS="pdf"
MP3_FILE_FORMAT_CLASS="\\CidiLabs\\Polly\\AwsPollyFileConversionProvider"

```

You will need to define your [AWS Credentials](https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials.html) in the AWS. For local the default is to put it in the env for docker-compose for your IAM Access keys. You should be using a EC2 IAM Role for AWS. In your docker-compose file

```
environment:
      - AWS_ACCESS_KEY_ID=
      - AWS_SECRET_ACCESS_KEY=

```

AwsPollyFileConversionProvider.php
==================================

[](#awspollyfileconversionproviderphp)

Basic Usage
-----------

[](#basic-usage)

- **fileName**: The name of the file
- **fileUrl**: The download URL for the file
- **fileType**: The file type of the original file
- **format**: The file type that we want to convert to (usually mp3)
- **S3Bucket**: Bucket in S3 you want to place the file in.
- **voice**: voice you want to use
- **TextType**: MUST be ssml or text
- **text**: html that you want to convert

```
$polly =  new  AwsPollyFileConversionProvider();

$fileUrl =  "https://cidilabs.instructure.com/files/295964/download?download_frd=1&verifier=RZwKCP3iVlNQIULZnTAXO0usUROMC9AuplKkDf2g";

$options =  array('fileUrl'  => $fileUrl,  'fileType'  =>  'pdf',  'format'  =>  'mp3',  'fileName'  =>  'Test1.pdf', 'S3Bucket' => 'polly' , 'voice' => 'Joanna', 'TextType' => 'ssml', 'text' => 'sample text');

$polly->convertFile($options);

```

Class Methods
-------------

[](#class-methods)

### convertFile

[](#convertfile)

### Public Methods

[](#public-methods)

#### Parameters

[](#parameters)

- ***options***: (array) Takes in options -- **fileName**: (string) The name of the file -- **fileUrl**: (string) The download URL for the file -- **fileType**: (string) The file type of the original file -- **format**: (string) The file type that we want to convert to -- **Text**: (String) in the end this is created by the function to transform html to ssml -- **TextType**: (String) The Type of Text, This MUST be ssml or text -- **voice**: The voice used in polly for the conversion -- **S3Bucket**: Where you want to put the polly converted files

#### Returns

[](#returns)

- ***taskId***: (string) The UUID representing the file conversion task
- ***null***

### isReady

[](#isready)

#### Parameters

[](#parameters-1)

- ***taskId***: (string) The UUID representing the file conversion task

#### Returns

[](#returns-1)

- ***True/False*** (boolean) True if the file has been converted and is ready, false otherwise

### getFileUrl

[](#getfileurl)

#### Parameters

[](#parameters-2)

- ***taskId***: (string) The UUID representing the file conversion task

#### Returns

[](#returns-2)

- ***fileUrl***: (string) The url of the converted file
- ***null***

### downloadFile

[](#downloadfile)

#### Parameters

[](#parameters-3)

- ***bucket***: (string) The bucket you want to download from
- ***key***: (string) key of the object you are trying to access

#### Returns

[](#returns-3)

### deleteFile

[](#deletefile)

#### Parameters

[](#parameters-4)

- ***fileUrl***: (string) The url of the converted file

#### Returns

[](#returns-4)

- ***True/False*** (boolean) True if successfully deleted, false otherwise

### Private Methods

[](#private-methods)

### deleteFileOnS3

[](#deletefileons3)

#### Parameters

[](#parameters-5)

- ***bucket***: (string) The bucket you want to delete from
- ***key***: (string) key of the object you are trying to delete

#### Returns

[](#returns-5)

SsmlCreator.php
===============

[](#ssmlcreatorphp)

Class Methods
-------------

[](#class-methods-1)

### buildSsmlText

[](#buildssmltext)

#### Parameters

[](#parameters-6)

- ***text***: (string) HTML to take in to convert to SSML

#### Returns

[](#returns-6)

- ***data*** (string) SSML

### Private Methods

[](#private-methods-1)

### setupBaseSSML

[](#setupbasessml)

#### Parameters

[](#parameters-7)

- ***html***: (string) brings in HTML to setup base before converting

#### Returns

[](#returns-7)

- ***html***: (string) returns base html

### convertToSSML

[](#converttossml)

#### Parameters

[](#parameters-8)

- ***html***: (string) HTML to be converted to SSML

#### Returns

[](#returns-8)

- ***ssml***: (string) returns ssml

### cleanChildNodes

[](#cleanchildnodes)

#### Parameters

[](#parameters-9)

- ***childNodes***: (Array) Array of ChildNodes of a DomElement

#### Returns

[](#returns-9)

### removeTagAttributes

[](#removetagattributes)

#### Parameters

[](#parameters-10)

- ***node***: (node) Brings in a node of a DomDocument

#### Returns

[](#returns-10)

- ***node***: (node) node of a DomDocument

### removeTagAttributes

[](#removetagattributes-1)

#### Parameters

[](#parameters-11)

- ***node***: (node) Brings in a node of a DomDocument

#### Returns

[](#returns-11)

- ***node***: (node) node of a DomDocument

### stripHTML

[](#striphtml)

#### Parameters

[](#parameters-12)

- ***html***: (string) html to strip out tags

#### Returns

[](#returns-12)

- ***html***: (string) html without tags

### changeTagName

[](#changetagname)

#### Parameters

[](#parameters-13)

- ***node***: (node) node to change element name
- ***name***: (string) name to change node to

#### Returns

[](#returns-13)

- ***newnode***: (node) returns a new node with the element or tag changed

### cleanUpBeforeDomDoc

[](#cleanupbeforedomdoc)

#### Parameters

[](#parameters-14)

- ***html***: (string) html to make sure is clean before setting up base

#### Returns

[](#returns-14)

- ***html***: (string) returns html with doctype and head removed

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 75.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~65 days

Total

3

Last Release

1167d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/025d15af9fe12f65e3fdb9c81ee542189839e7869bf48e2c9d23956a9e6ceb26?d=identicon)[crandallchuck](/maintainers/crandallchuck)

---

Top Contributors

[![cidilabs](https://avatars.githubusercontent.com/u/46353870?v=4)](https://github.com/cidilabs "cidilabs (22 commits)")[![sgcooper78](https://avatars.githubusercontent.com/u/48975452?v=4)](https://github.com/sgcooper78 "sgcooper78 (3 commits)")[![webchuckweb](https://avatars.githubusercontent.com/u/13257605?v=4)](https://github.com/webchuckweb "webchuckweb (3 commits)")[![cidijohn](https://avatars.githubusercontent.com/u/155491114?v=4)](https://github.com/cidijohn "cidijohn (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cidilabs-aws-polly/health.svg)

```
[![Health](https://phpackages.com/badges/cidilabs-aws-polly/health.svg)](https://phpackages.com/packages/cidilabs-aws-polly)
```

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
