Php Google Tts Class

v2.1.11 2021-11-07 19:17 UTC

This package is auto-updated.

Last update: 2024-03-25 18:07:07 UTC


README

Simple Google Tts Api Class

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

Features

  • Set Api Key, Text, Lang Code, Voice Name, Encoding, Pitch, Rate, Save Path
  • Fast, Simple and Light

Install

run the following command directly.

$ composer require omerfdmrl/tts

Simple Usage

include 'vendor/autoload.php';

use Omerfdmrl\Tts\Tts;

$tts = new Tts;

// Set Google Api Code
$tts->setApi('Api_Code');

// Set Text
$tts->setText('Hello World!');

// Send request to Google and save voice
$tts->get();

Advanced Usage

include 'vendor/autoload.php';

use Omerfdmrl\Tts\Tts;

$tts = new Tts;

// Set Google Api Code
$tts->setApi('Api_Code');

// Set Text
$tts->setText('Hello World!');

// Set Save Path
// Default is ./tts.mp3
$tts->setSavePath('tts.mp3');

// Set Language Code
// Default is en-US
$tts->setLanguageCode('en-US');

// Set Voice Name
// Default is en-US-Wavenet-F
$tts->setVoiceName('en-US-Wavenet-F');

// Set Encoding Type
// Default is MP3
$tts->setEncoding('MP3');

// Set Pitch
// Default is 0.00
$tts->setPitch(0.00);

// Set Speaking Rate
// Default is 1.00
$tts->setSpeakingRate(1.00);

// Send request to Google and save voice
$tts->get();

// Get error if exist
echo $tts->error();

Docs

Documentation page: Docs

Licence

MIT Licence

Contributing

  1. Fork it ( https://github.com/omerfdmrl/tts/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • omerfdmrl Ömer Faruk Demirel - creator, maintainer