PHPackages                             laraveladmin/translate-tool - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. laraveladmin/translate-tool

ActiveLibrary[Localization &amp; i18n](/categories/localization)

laraveladmin/translate-tool
===========================

一个集成百度翻译，有道翻译，Google 翻译的PHP composer package

v1.2.5(1y ago)02.2k↓50%1MITPHP

Since Apr 23Pushed 1y agoCompare

[ Source](https://github.com/laraveladmin-cn/translate)[ Packagist](https://packagist.org/packages/laraveladmin/translate-tool)[ RSS](/packages/laraveladmin-translate-tool/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (5)Used By (1)

Translate for PHP
=================

[](#translate-for-php)

---

[![](https://camo.githubusercontent.com/5c9f02822ab7238d658901207fc988d82a7d8b3f43e4c79fb83d59728c5cc83e/68747470733a2f2f7472617669732d63692e6f72672f5368616f5a654d696e672f7472616e736c6174652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ShaoZeMing/translate)[![](https://camo.githubusercontent.com/7bbcea600d80856f3eb743acb304652cf0bc25c1c40fbfb0d6f928b21a8a3ee6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f5368616f5a654d696e672f7472616e736c6174652e737667)](https://packagist.org/packages/shaozeming/translate)[![](https://camo.githubusercontent.com/03a51343aab0694d26c09e2e1d4f8691158e10f362ce0454c0fdfbf7156a756a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f5368616f5a654d696e672f7472616e736c6174652e737667)](https://packagist.org/packages/stichoza/shaozeming/translate)

Installing
----------

[](#installing)

```
$ composer require shaozeming/translate -v
```

### configuration

[](#configuration)

```
// config/translate.php

    //使用什么翻译驱动
    // 目前支持这几种: "baidu", "youdao","google"
    /*
     *  默认使用google  google使用的是免费接口爬取，目前能用，为了确保稳定，请配置一个备用服务， 目前只有google和baidu 支持繁体翻译
     */
    'defaults' => [
        'driver' => 'google',   //默认使用google翻译
        'spare_driver' => 'baidu',  // 备用翻译api ,第一个翻译失败情况下，调用备用翻译服务，填写备用翻译api 需要在下面对应的drivers中配置你参数
        'from' => 'zh',   //原文本语言类型 ，目前支持：auto【自动检测】,en【英语】,zh【中文】，jp【日语】,ko【韩语】，fr【法语】，ru【俄文】，pt【西班牙】
        'to' => 'en',     //翻译文本 ：en【英语】,zh【中文】，jp【日语】,ko【韩语】，fr【法语】，ru【俄文】，pt【西班牙】,
    ],

       'drivers' => [
           'baidu' => [
               'base_url' => 'http://api.fanyi.baidu.com/api/trans/vip/translate',
               //App id of the translation api
               'app_id' => '20180611000174972',
               //secret of the translation api
               'app_key' => 'cEXha7w4elaXO23NJ2Tt',
           ],

           'youdao' => [
               'base_url' => 'https://openapi.youdao.com/api',
               //App id of the translation api
               'app_id' => '',
               //secret of the translation api
               'app_key' => '',
           ],

           'google' => [
               'base_url' => 'http://translate.google.cn/translate_a/single',
               'app_id' => '',
               'app_key' => '',
           ],
       ],
```

Usage
-----

[](#usage)

```
use ShaoZeMing\Translate\TranslateService;

$config = include($youerpath.'/translate.php')

$obj = new TranslateService($config);
$result = $obj->translate('你知道我对你不仅仅是喜欢');
print_r($result);

```

Example:

```
 // 动态更改翻译服务商
 $config = include($youerpath.'/translate.php')
 $obj = new TranslateService($config);
 $obj->setDriver('baidu')->translate('你知道我对你不仅仅是喜欢');
 print_r($result);
 //You know I'm not just like you

 // 动态更改语种

 $from = 'en';
 $to = 'zh';
 $result =  $obj->setDriver('baidu')->setFromAndTo($from,$to)->translate('I love you.');
print_r($result);
```

License
-------

[](#license)

MIT

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76.5% 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 ~407 days

Total

4

Last Release

630d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e27ac1f74b7f11f4c9ae7ab091e6024851e50d7aad798fabea46bd2f9c6134be?d=identicon)[laraveladmin](/maintainers/laraveladmin)

---

Top Contributors

[![ShaoZeMing](https://avatars.githubusercontent.com/u/19376576?v=4)](https://github.com/ShaoZeMing "ShaoZeMing (13 commits)")[![zsping1989](https://avatars.githubusercontent.com/u/11209094?v=4)](https://github.com/zsping1989 "zsping1989 (3 commits)")[![laraveladmin-cn](https://avatars.githubusercontent.com/u/76767270?v=4)](https://github.com/laraveladmin-cn "laraveladmin-cn (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laraveladmin-translate-tool/health.svg)

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

###  Alternatives

[vemcogroup/laravel-translation

Translation package for Laravel to scan for localisations and up/download to poeditor

135304.0k2](/packages/vemcogroup-laravel-translation)[stevebauman/translation

An easy automatic database driven translator for Laravel 5

7620.1k](/packages/stevebauman-translation)[mage-os/module-automatic-translation

Automatic AI content translation for Mage-OS.

277.1k](/packages/mage-os-module-automatic-translation)[acclaro/translations

Easily launch and manage multilingual Craft websites without having to copy/paste content or manually track updates.

1229.5k](/packages/acclaro-translations)

PHPackages © 2026

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