PHPackages                             sxqibo/fast-translate - 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. sxqibo/fast-translate

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

sxqibo/fast-translate
=====================

v0.8(9mo ago)015MITPHP

Since Jun 20Pushed 9mo agoCompare

[ Source](https://github.com/sxqibo/fastTranslate)[ Packagist](https://packagist.org/packages/sxqibo/fast-translate)[ RSS](/packages/sxqibo-fast-translate/feed)WikiDiscussions main Synced 1mo ago

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

fastTranslate
=============

[](#fasttranslate)

说明： 集成 百度翻译、谷歌翻译 的包管理！

百度翻译
----

[](#百度翻译)

网址：
注意：常见语种列表， 有种语种简码
优点：百度翻译可以翻译
缺点：识别源语言的接口特别有限

示例：

```
$config  = [
    'app_id'  => '',
    'sec_key' => ''
];
$type = 'baidu';
$obj  = TranslateFactory::getTranslateObject($type, $config);
$addr = $obj->getTranslate('你好', 'en', $type);
```

谷歌翻译V2示例
--------

[](#谷歌翻译v2示例)

网址：
文档：语言支持：
优点： 谷歌翻译可以翻译，但识别源语言的接口特别多
缺点： 谷歌翻译V2需要api\_key，本地测试需要翻墙， 需要信用卡配额, 网址：
说明： 谷歌翻译配置比较麻烦，需要创建项目，绑定支付账号， 申请api\_key 示例：

```
$config  = [
    'api_key'  => ''
];

$type = 'googleV2';
$obj  = TranslateFactory::getTranslateObject($type, $config);
$addr = $obj->getTranslate('你好', 'en', $type);
```

返回

```
{
  "source" : "zh-CN",
  "input" : "你好",
  "text" : "Hello",
  "model" : ""
}
```

说明： 谷歌翻译原生curl请求

```
curl -X POST "https://translation.googleapis.com/language/translate/v2?key=API_KEY" \
       -H "Content-Type: application/json" \
       -d '{
             "q": "你好",
             "target": "en"
           }'

```

原生返回：

```
{
  "data": {
    "translations": [
      {
        "translatedText": "Hello",
        "detectedSourceLanguage": "zh-CN"
      }
    ]
  }
}
```

谷歌翻译V3示例
--------

[](#谷歌翻译v3示例)

文档：

创建服务账号并下载 JSON 凭据：

打开 Google Cloud 控制台：

创建一个服务账号，并授予所需的权限（如翻译 API 权限）

位置： IAM和管理 / 服务账号， 在操作中，点击管理密钥, 创建密钥，选择 JSON 格式并下载, 我下载后的格式是： translate2025-464112-daa7d0598c52.json

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance57

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 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

Every ~4 days

Total

8

Last Release

297d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f32e92c7e68c3d0af13677702b745fea90913ed6173f1a0c9506f0d25a50ebe?d=identicon)[hongweizhiyuan](/maintainers/hongweizhiyuan)

---

Top Contributors

[![hongweizhiyuan](https://avatars.githubusercontent.com/u/2313822?v=4)](https://github.com/hongweizhiyuan "hongweizhiyuan (18 commits)")

### Embed Badge

![Health badge](/badges/sxqibo-fast-translate/health.svg)

```
[![Health](https://phpackages.com/badges/sxqibo-fast-translate/health.svg)](https://phpackages.com/packages/sxqibo-fast-translate)
```

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[aedart/athenaeum

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

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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