PHPackages                             mathsgod/r-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. mathsgod/r-translate

ActiveLibrary

mathsgod/r-translate
====================

Using google translate to translate word

1.0.3(5y ago)064↓100%3PHP

Since May 21Pushed 1mo ago1 watchersCompare

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

READMEChangelog (2)Dependencies (1)Versions (4)Used By (3)

r-translate
===========

[](#r-translate)

A simple PHP library that uses Google Translate to translate text between languages.

Requirements
------------

[](#requirements)

- PHP 7.0+
- Composer

Installation
------------

[](#installation)

```
composer require mathsgod/r-translate
```

Usage
-----

[](#usage)

```
require_once __DIR__ . "/vendor/autoload.php";

use R\Translate;

$t = new Translate();

// Translate from auto-detected language to English
$result = $t->translate("你好", "auto", "en");
echo $result; // Hello

// Translate from Traditional Chinese to English
$result = $t->translate("數據中心選擇", "zh-TW", "en");
echo $result;
```

### `translate($text, $from, $to)`

[](#translatetext-from-to)

Translates the given text.

ParameterTypeDescription`$text`stringThe text to translate`$from`stringSource language code (e.g. `"zh-TW"`, `"auto"`)`$to`stringTarget language code (e.g. `"en"`, `"ja"`)Returns the translated string.

**Supported language codes:** Use standard BCP 47 language tags such as `en`, `zh-TW`, `zh-CN`, `ja`, `ko`, `fr`, `de`, `es`, etc. Use `"auto"` to let Google detect the source language automatically.

Running Tests
-------------

[](#running-tests)

```
vendor/bin/phpunit
```

Author
------

[](#author)

Raymond Chong &lt;&gt;

License
-------

[](#license)

MIT

###  Health Score

40

—

FairBetter than 87% of packages

Maintenance63

Regular maintenance activity

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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 ~947 days

Total

2

Last Release

1962d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/30f25555e58060ace793b731c172c739d45e9506154c9611990d2f985f61652b?d=identicon)[mathsgod](/maintainers/mathsgod)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mathsgod-r-translate/health.svg)

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

PHPackages © 2026

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