PHPackages                             raison/easy-tts-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. raison/easy-tts-laravel

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

raison/easy-tts-laravel
=======================

The easiest way to use tts

1.0.0(3y ago)10263[1 issues](https://github.com/wongyuxuan/easy-tts-laravel/issues)MITPHPPHP &gt;=7.4

Since Oct 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/wongyuxuan/easy-tts-laravel)[ Packagist](https://packagist.org/packages/raison/easy-tts-laravel)[ RSS](/packages/raison-easy-tts-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (2)Used By (0)

Easy Tts For Laravel
====================

[](#easy-tts-for-laravel)

 一款满足你的多种TTS平台调用组件

[![](https://camo.githubusercontent.com/f661c51413610e3777beb9d8b376177261b2dd97cb03d260747505ca9ad91a02/687474703a2f2f706f7365722e707567782e6f72672f726169736f6e2f656173792d7474732d6c61726176656c2f646f776e6c6f616473)](https://packagist.org/packages/raison/easy-tts-laravel)[![](https://camo.githubusercontent.com/78ada75f77d3d959e9f6bb717f925085b7e85c1f260c575b8499b0cb5f2ae85c/687474703a2f2f706f7365722e707567782e6f72672f726169736f6e2f656173792d7474732d6c61726176656c2f6c6963656e7365)](https://packagist.org/packages/raison/easy-tts-laravel)[![](https://camo.githubusercontent.com/92e1ceceb41e812d0e985dd5c9fdfd875270905ac06c6d32b6737e87168b3509/687474703a2f2f706f7365722e707567782e6f72672f726169736f6e2f656173792d7474732d6c61726176656c2f726571756972652f706870)](https://packagist.org/packages/raison/easy-tts-laravel)

特点
--

[](#特点)

1. 支持目前市面多家服务商
2. 一套写法兼容所有平台
3. 支持实时流式返回（短文本）创建异步任务（长文本）
4. 支持多种参数设置
5. 更多等你去发现与改进...

平台支持
----

[](#平台支持)

- [科大讯飞 Tts](https://www.xfyun.cn/services/online_tts)
- [腾讯云 Tts](https://cloud.tencent.com/product/tts)
- [阿里云 Tts](https://ai.aliyun.com/nls/tts)
- [百度云 Tts](https://ai.baidu.com/tech/speech)
- ...

环境需求
----

[](#环境需求)

- PHP &gt;= 7.4

安装
--

[](#安装)

```
$ composer require raison/easy-tts-laravel
```

各平台配置说明
-------

[](#各平台配置说明)

### 在 config/app.php 文件中设置服务提供者和别名。

[](#在-configappphp-文件中设置服务提供者和别名)

```
'providers' => [
    ....
    EasyTts\Providers\LaravelServiceProvider::class,
    ....
],
```

\###请使用下面这条命令来发布配置文件

```
 php artisan vendor:publish --provider="EasyTts\Providers\LaravelServiceProvider"
```

### [科大讯飞](https://www.xfyun.cn/services/online_tts)

[](#科大讯飞)

```
'xunfei' => [
            'driver' => 'xunfei',
            'appid' => '',
            'secret_id' => '',
            'secret_key' => '',
        ],
```

### [腾讯云](https://cloud.tencent.com/product/tts)

[](#腾讯云)

```
'tencent' => [
            'driver' => 'tencent',
            'appid' => '',
            'secret_id' => '',
            'secret_key' => '',
        ],
```

### [阿里云](https://ai.aliyun.com/nls/tts)

[](#阿里云)

```
'aliyun' => [
            'driver' => 'aliyun',
            'appid' => '',
            'secret_id' => '',
            'secret_key' => '',
        ],
```

### [百度云](https://ai.baidu.com/tech/speech)

[](#百度云)

```
'baidu' => [
            'driver' => 'baidu',
            'appid' => '',
            'secret_id' => '',
            'secret_key' => '',
        ],
```

使用
--

[](#使用)

```
use EasyTts\TtsManager;

(new TtsManager())->client()->textToSpeechStream('PHP是全世界最好的语言');
```

### [科大讯飞](https://www.xfyun.cn/services/online_tts)

[](#科大讯飞-1)

平台支持方式 `短文本(流返回)`

`流式返回(短文本)` [请求参数说明](https://www.xfyun.cn/services/online_tts)

```
use EasyTts\TtsManager;

$text = "php是全世界最好的语言";
$config = [
            'speed' => 50,
            'volume' => 50,
            'vcn' => "xiaoyan",
        ];

return (new TtsManager())->client('xunfei')->setRequestConfig($config)->textToSpeechStream($text);
```

### [腾讯云](https://cloud.tencent.com/product/tts)

[](#腾讯云-1)

`流式返回(短文本)` [请求参数说明](https://cloud.tencent.com/document/product/1073/57373)

```
use EasyTts\TtsManager;

$text = "php是全世界最好的语言";
$config = [
            'Speed' => 0,
            'Volume' => 0,
            'VoiceType' => 10510000,
        ];

return (new TtsManager())->client('tencent')->setRequestConfig($config)->textToSpeechStream($text);
```

`创建任务 (长文本)` [请求参数说明](https://cloud.tencent.com/document/product/1073/57373)

```
use EasyTts\TtsManager;

$text = "php是全世界最好的语言";
$config = [
            'Speed' => 0,
            'Volume' => 0,
            'VoiceType' => 10510000,
        ];

// 创建异步任务
$task_id = (new TtsManager())->client('tencent')->setRequestConfig($config)->createTask($text);
// 通过任务id获取结果
$res = (new TtsManager())->client('tencent')->fetchTaskResult($task_id);
```

### [阿里云](https://ai.aliyun.com/nls/tts)

[](#阿里云-1)

`流式返回(短文本)` [请求参数说明](https://help.aliyun.com/document_detail/429509.html#sectiondiv-h8d-iax-ofm)

```
use EasyTts\TtsManager;

$text = "php是全世界最好的语言";
$config = [
            'speech_rate' => 200,
            'voice' => 70,
            'voice' => "zhitian_emo",
        ];

return (new TtsManager())->client('aliyun')->setRequestConfig($config)->textToSpeechStream($text);
```

`创建任务 (长文本)` [请求参数说明](https://help.aliyun.com/document_detail/130509.html#section-r1y-bhg-824)

```
use EasyTts\TtsManager;

$text = "php是全世界最好的语言";
$config = [
            'speech_rate' => 200,
            'voice' => 70,
            'voice' => "zhitian_emo",
        ];

// 创建异步任务
$task_id = (new TtsManager())->client('aliyun')->setRequestConfig($config)->createTask($text);
// 通过任务id获取结果
$res = (new TtsManager())->client('aliyun')->fetchTaskResult($task_id);
```

### [百度云](https://ai.baidu.com/tech/speech)

[](#百度云-1)

`流式返回(短文本)` [请求参数说明](https://ai.baidu.com/ai-doc/SPEECH/Qk38y8lrl)

```
use EasyTts\TtsManager;

$text = "php是全世界最好的语言";
$config = [
            'spd' => 10,
            'vol' => 10,
            'per' => 3,
        ];

return (new TtsManager())->client('baidu')->setRequestConfig($config)->textToSpeechStream($text);
```

`创建任务 (长文本)` [请求参数说明](https://ai.baidu.com/ai-doc/SPEECH/1ku59x8ey)

```
use EasyTts\TtsManager;

$text = "php是全世界最好的语言";
$config = [
            'speed' => 10,
            'volume' => 10,
            'voice' => 3,
        ];

// 创建异步任务
$task_id = (new TtsManager())->client('baidu')->setRequestConfig($config)->createTask($text);
// 通过任务id获取结果
$res = (new TtsManager())->client('baidu')->fetchTaskResult($task_id);
```

License
-------

[](#license)

MIT

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1297d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/26f45a0d665aeccbf23b4dd0c09c8df7ec9c9f64f393d0401e59402dc6966900?d=identicon)[wongyuxuan](/maintainers/wongyuxuan)

---

Top Contributors

[![wongyuxuan](https://avatars.githubusercontent.com/u/30743084?v=4)](https://github.com/wongyuxuan "wongyuxuan (6 commits)")

---

Tags

sdktencentttsALIbaiduxufetts-sdk

### Embed Badge

![Health badge](/badges/raison-easy-tts-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/raison-easy-tts-laravel/health.svg)](https://phpackages.com/packages/raison-easy-tts-laravel)
```

###  Alternatives

[alibabacloud/sdk

Alibaba Cloud SDK for PHP - Easier to Use Alibaba Cloud in your PHP project

5282.1M45](/packages/alibabacloud-sdk)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
