PHPackages                             googletran/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. [API Development](/categories/api)
4. /
5. googletran/translate

Abandoned → [gtran/translate](/?search=gtran%2Ftranslate)Library[API Development](/categories/api)

googletran/translate
====================

Making Google Cloud translation API version 2 consumption easier in Laravel 5+.

8.0(5y ago)023[2 PRs](https://github.com/InputOutputZ/GTran/pulls)UnlicensePHP

Since Jan 30Pushed 3y ago1 watchersCompare

[ Source](https://github.com/InputOutputZ/GTran)[ Packagist](https://packagist.org/packages/googletran/translate)[ Docs](https://github.com/InputOutputZ/GTran)[ RSS](/packages/googletran-translate/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (1)Versions (10)Used By (0)

GTran
=====

[](#gtran)

Making Google Cloud translation API version 2 consumption easier in Laravel 5+.

### Through this integration you can do the following

[](#through-this-integration-you-can-do-the-following)

- Detect information about text such as language code and script. Refer to GTran@detectTextInformation.
- Translates text from one language to another. Accepts String or concatenated Strings as translation query. Refer to GTran@translateText.
- Translates text from one language to another. Accepts Array as translation query. Refer to GTran@translateTextWithoutConcat.
- Request available languages for translation including list of languages code. Refer to GTran@translationsAvailable.

Laravel Google Cloud Translator Integration
-------------------------------------------

[](#laravel-google-cloud-translator-integration)

There are 3 files to have a look at so to understand how the integration works

- config/gtran.php (Configuration of API endpoints &amp; authorisation key)
- routes.php (Configuring PlayWithAPIController routes)
- GTran\\Translate\\PlayWithAPIController (A Controller with on hand methods playing with the API endpoints)

### Required Packages

[](#required-packages)

```
"guzzlehttp/guzzle": "^7.0.1",
```

Installation for Laravel 5+. Tested on 8.40.
============================================

[](#installation-for-laravel-5-tested-on-840)

- 1- Go to your laravel project root directory and install the package locally:-

```
composer require "gtran/translate"
```

- 2- Install the service provider and load config as well as routes references:-

```
php artisan vendor:publish
```

- 3- Choose "GTran\\Translate\\GTranServiceProvider" provider from the list via typing its index value.
- 4- Go to env file and include at the bottom:-

```
GOOGLETRAN_KEY=Google Cloud API KEY
```

- 5- Well Done!

Installation for older Laravel
==============================

[](#installation-for-older-laravel)

### You may expect more debugging to get it working.

[](#you-may-expect-more-debugging-to-get-it-working)

- 1- Go to your laravel project root directory and install the package locally:-

```
composer require "gtran/translate"
```

- 2- Add GTran service provider manually to the providers list in config/app.php:-

```
'providers' => [
    // ...
    GTran\Translate\\GTranServiceProvider::class,
]
```

- 3- Load config as well as routes references:-

```
php artisan vendor:publish --force --provider="GTran\Translate\GTranServiceProvider"
```

- 4- Go to env file and include at the bottom:-

```
GOOGLETRAN_KEY=Google Cloud API KEY
```

- 5- Well Done!

Demo with PlayWithAPIController and Postman
===========================================

[](#demo-with-playwithapicontroller-and-postman)

Configuration
-------------

[](#configuration)

- Codebase Configuration

-1 Go To PlayWithAPIController

-2 Go to definition of detectTextInformation and translateText.

-3 Examine the functions

- detectTextInformation | Postman Configuration to route "" and POST type.

-1 Include following headers:-

```
Accept: application/json
```

2- Include following Body: form-data

```
KEY     TEXT
query    Hello
```

3- Response

```
{
  "data": {
    "detections": [
      [
        {
          "confidence": 1,
          "isReliable": false,
          "language": "en"
        }
      ]
    ]
  }
}
```

- translationsAvailable | Postman Configuration to route "" and POST type.

-1 Include following headers:-

```
Accept: application/json
```

2- Include following Body: form-data

```
KEY     TEXT
model    base, P.S. you can go for nmt, Neural Machine Translation.
locale   en
```

3- Response

```
{
  "data": {
    "languages": [
      {
        "language": "af",
        "name": "Afrikaans"
      },
      {
        "language": "sq",
        "name": "Albanian"
      },
      {
        "language": "am",
        "name": "Amharic"
      },
      {.................................
```

Usage
=====

[](#usage)

### Import Use at the top in any of your laravel project controllers / traits.

[](#import-use-at-the-top-in-any-of-your-laravel-project-controllers--traits)

```
use GTran;
```

### Access functions through

[](#access-functions-through)

```
GTran::detectTextInformation($query);
```

Available functions
-------------------

[](#available-functions)

- detectTextInformation($query,$concat = false,$concatType = false)
- translateTextWithoutConcat($queries, $target, $source, $format, $model)
- translateText($query,$target,$source,$format,$model,$concat = false,$concatType = false)
- translationsAvailable($model,$locale)

About
-----

[](#about)

The GTran package was published under The Unlicense licence. If you have any problems, please feel free to reach out at .

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity66

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

Total

4

Last Release

1832d ago

Major Versions

5.8 → 7.02020-12-31

7.0 → 8.02021-05-04

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/200735?v=4)[zakaria](/maintainers/zakaria)[@zakaria](https://github.com/zakaria)

---

Top Contributors

[![InputOutputZ](https://avatars.githubusercontent.com/u/4721398?v=4)](https://github.com/InputOutputZ "InputOutputZ (41 commits)")

---

Tags

apilaravellanguagetranslatelanguagescloudgoogletranslationtranslatorservicesversiontransliteratedetectcognitive2easiernmtpbmt

### Embed Badge

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

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

###  Alternatives

[google/cloud

Google Cloud Client Library

1.2k16.2M54](/packages/google-cloud)[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[eko/googletranslatebundle

A Symfony bundle to deals with Google Translate API

4337.1k](/packages/eko-googletranslatebundle)[statickidz/php-google-translate-free

Google Translate Free library for PHP

289258.8k6](/packages/statickidz-php-google-translate-free)[chriskonnertz/deeply

DeepLy is a PHP client for the DeepL.com translation API

230116.2k8](/packages/chriskonnertz-deeply)[mozex/anthropic-laravel

Anthropic PHP for Laravel is a supercharged PHP API client that allows you to interact with the Anthropic API

71226.4k1](/packages/mozex-anthropic-laravel)

PHPackages © 2026

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