naroat/voice-api

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

v1.0.0 2025-04-11 03:00 UTC

This package is auto-updated.

Last update: 2025-04-11 03:03:29 UTC


README

ai语音api

功能

已支持:

  • 阿里云

使用

$voice = new Voice();
$aliyunVoice = $voice->driver('aliyun', [
    'appkey' => 'you appkey',
    'token' => 'you token',
]);

$response = $aliyunVoice->setText('今天是周一,天气挺好的。')
    ->setVoice('xiaoyun')
    ->setFormat('mp3')
    ->tts();

//save file
if ($response->getStatusCode() == 200 && in_array('audio/mpeg', $response->getHeader('Content-Type'))) {
    file_put_contents('./tmp.mp3', $response->getBody());
}