Download the PHP package ahmadmayahi/php-amazon-polly without Composer

On this page you can find all versions of the php package ahmadmayahi/php-amazon-polly. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-amazon-polly


[![The Latest Version on Packagist](https://img.shields.io/packagist/v/ahmadmayahi/php-amazon-polly.svg)](https://packagist.org/packages/ahmadmayahi/php-amazon-polly) [![Tests](https://github.com/ahmadmayahi/php-amazon-polly/actions/workflows/run-tests.yml/badge.svg)](https://github.com/ahmadmayahi/php-amazon-polly/actions/workflows/run-tests.yml) [![Check & fix styling](https://github.com/ahmadmayahi/php-amazon-polly/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/ahmadmayahi/php-amazon-polly/actions/workflows/php-cs-fixer.yml) [![Test Coverage](https://codecov.io/gh/ahmadmayahi/php-amazon-polly/branch/main/graph/badge.svg?token=hayMyn8tLI)](https://codecov.io/gh/ahmadmayahi/php-amazon-polly)

Requires PHP 8.1+

For feedback, please contact me.

PHP Amazon Polly is an easy and elegant wrapper around Amazon Polly, a service that turns text into lifelike speech.

Contents

Installation

You can install the package via composer:

Usage

First you need to configure the client:

Save as MP3 file:

The convert method returns an object of type AhmadMayahi\Polly\Data\SpeechFile which has three properties:

By default, the convert method saves the file into the default temp. directory; If you want to save the file into a specific directory then you might need to provide the file path as param:

The voiceId() also accepts a string:

Alternatively, you may also specify the output format as an enum or a string:

Speech Marks

You may also request the Speech Mark Types as follows:

SSML

If the given text starts with <spaek> then the SSML will be used while synthesizing:

Read more about SSML.

Standard vs Neural Voices

Amazon Polly provides two voice systems Standard and Neural.

The Neural system can produce higher quality voices than the standard voices.

By default, this package will always use the Standard voice if available, however, some voices such as Olivia (English Australian) is only available as Neural.

You may use the neuralVoice() or standardVoice() methods as follows:

Not all the voices support the nueral system, for more information please visit Voices in Amazon Polly page.

Convenient Voice Methods

PHP Amazon Polly provides a convenient way to get the appropriate voice id without the need to inspect the documentation.

For example, if you want to use Joanna you may use englishUnitedStatesJoanna() method as follows:

As you might have noticed, Joanna accepts an optional param $neural, set it to true if you want neural voice.

Here is the full list of voices with their equivalent method:

Voice Method
Arabic (Zeina) arabicZeina()
Chinese (Zhiyu) chineseZhiyu()
Danish (Naja) danishNaja()
Danish (Mads) danishMads()
Dutch (Lotte) dutchLotte()
Dutch (Ruben) dutchRuben()
English Australian (Nicole) englishAustralianNicole()
English Australian (Olivia) englishAustralianOlivia($neural = false)
English Australian (Russel) englishAustralianRussel()
English British (Amy) englishBritishAmy($neural = false)
English British (Brian) englishBritishEmma($neural = false)
English Indian (Aditi) englishIndianAditi()
English Indian (Raveena) englishIndianRaveena()
English New Zealand (Aria) englishNewZealandAria()
English South African (Ayanda) englishSouthAfricanAyanda()
English United States (Ivy) englishUnitedStatesIvy($neural = false)
English United States (Joanna) englishUnitedStatesJoanna($neural = false)
English United States (Kendra) englishUnitedStatesKendra($neural = false)
English United States (Kimberly) englishUnitedStatesKimberly($neural = false)
English United States (Salli) englishUnitedStatesSalli($neural = false)
English United States (Joey) englishUnitedStatesJoey($neural = false)
English United States (Justin) englishUnitedStatesJustin($neural = false)
English United States (Kevin) englishUnitedStatesKevin($neural = false)
English United States (Matthew) englishUnitedStatesMatthew($neural = false)
English Welsh (Geraint) englishWelsh()

Voice Enums

All the Amazon Polly Voices are supported as enums:

Language Enum
Arabic AhmadMayahi\Polly\Voices\Arabic
Chinese, Mandarin AhmadMayahi\Polly\Voices\Chinese
Danish AhmadMayahi\Polly\Voices\Danish
Dutch AhmadMayahi\Polly\Voices\Dutch
English (Australian) AhmadMayahi\Polly\Voices\English\Australian
English (British) AhmadMayahi\Polly\Voices\English\British
English (Indian) AhmadMayahi\Polly\Voices\English\Indian
English (New Zealand) AhmadMayahi\Polly\Voices\English\NewZealand
English (South African) AhmadMayahi\Polly\Voices\English\SouthAfrican
English (United States) AhmadMayahi\Polly\Voices\English\UnitedStates
French AhmadMayahi\Polly\Voices\French\French
French (Canadian) AhmadMayahi\Polly\Voices\French\Canadian
German AhmadMayahi\Polly\Voices\German
Hindi AhmadMayahi\Polly\Voices\Hindi
Icelandic AhmadMayahi\Polly\Voices\Icelandic
Italian AhmadMayahi\Polly\Voices\Italian
Japanese AhmadMayahi\Polly\Voices\Japanese
Korean AhmadMayahi\Polly\Voices\Korean
Portuguese (Brazil) AhmadMayahi\Polly\Voices\Portuguese\Brazil
Portuguese (Portugal) AhmadMayahi\Polly\Voices\Portuguese\Portugal
Romanian AhmadMayahi\Polly\Voices\Romanian
Russian AhmadMayahi\Polly\Voices\Russian
Spanish (Mexican) AhmadMayahi\Polly\Voices\Spanish\Mexico
Spanish (Spain) AhmadMayahi\Polly\Voices\Spanish\Spain
Spanish (United States) AhmadMayahi\Polly\Voices\Spanish\UnitedStates
Swedish AhmadMayahi\Polly\Voices\Swedish
Turkish AhmadMayahi\Polly\Voices\Turkish
Welsh AhmadMayahi\Polly\Voices\Welsh

For example, if you want to get Nicole from English (Australian):

Describe Voice

You can also describe the voice using the describe method as follows:

The describe method returns an object of type AhmadMayahi\Polly\Data\DescribeVoice with the following properties:

According to Amazon Polly documentation, Aditi (Hindi) she's the only one who speaks both Indian English (en-IN) and Hindi (hi-IN) fluently.

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of php-amazon-polly with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
aws/aws-sdk-php Version ^3.208
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ahmadmayahi/php-amazon-polly contains the following files

Loading the files please wait ....