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.3k↓13.3%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 today

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 69% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

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

675d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12211163?v=4)[laraveladmin](/maintainers/laraveladmin)[@laraveladmin](https://github.com/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

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M47](/packages/tencentcloud-tencentcloud-sdk-php)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

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