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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mathsgod/r-translate

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

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

Using google translate to translate word

1.0.3(5y ago)0663PHP

Since May 21Pushed 3mo 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 3w 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

38

—

LowBetter than 83% of packages

Maintenance55

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community12

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

2007d ago

### Community

Maintainers

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

###  Alternatives

[lukeyouell/craft-geocookie

Collect information about a visitor's location based on their IP address and store the information as a cookie.

136.3k](/packages/lukeyouell-craft-geocookie)

PHPackages © 2026

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