There is no license information available for the latest version (v1.2.0) of this package.

Google Text-to-Speech for php

v1.2.0 2023-06-20 01:14 UTC

This package is auto-updated.

Last update: 2024-05-20 03:24:02 UTC


README

Install

composer require thuanvp012van/gtts

Usage

  1. Use with php

    use Thuanvp012van\GTTS\GTTS;
    use Thuanvp012van\GTTS\Language;
    
    require './vendor/autoload.php';
    
    $gtts = new GTTS('Xin chào mọi người', Language::VI); // or $gtts = (new GTTS('Xin chào mọi người'))->autoDetection(true);
    $gtts->save('helloworld.mp3');
  2. Use with command-line

    php ./vendor/bin/gtts languages # Show all languages
    php ./vendor/bin/gtts save --file=helloworld.mp3 --language=vi 'Xin chào mọi người' # Convert text to speech.

    OR

    php ./vendor/bin/gtts save --file=helloworld.mp3 --auto-detection 'Xin chào mọi người' # Automatic language detection.

Methods

  • text(string $text): Set text.
  • getText(): Get text.
  • lang(\Thuanvp012van\GTTS\Language $lang): Set language.
  • getLang(): Get language.
  • autoDetection(bool $autoDetection): Set auto detection.
  • isAutoDetection(): Check is auto detection.
  • topLevelDomain(string $tld): Set top level domain.
  • getLevelDomain(): Get top level domain.
  • slowSpeed(): Set slow reading speed.
  • normalSpeed(): Set normal reading speed.
  • isSlowSpeed(): Check is slow reading speed.
  • isNormalSpeed(): Check is normal reading speed.
  • save(string $fileName): Save speech as file.
  • stream(): Get parts of speech.