thuanvp012van / gtts
Google Text-to-Speech for php
Installs: 35
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 2
Open Issues: 0
pkg:composer/thuanvp012van/gtts
Requires
- php: >=8.0
- guzzlehttp/guzzle: >=7.5
- symfony/console: >=6.1
This package is auto-updated.
Last update: 2025-10-20 06:29:24 UTC
README
Install
composer require thuanvp012van/gtts
Usage
-
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');
-
Use with command-line
php ./vendor/bin/gtts languages # Show all languagesphp ./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.