PHPackages                             gabrielesbaiz/google-translate-toolkit - 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. gabrielesbaiz/google-translate-toolkit

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

gabrielesbaiz/google-translate-toolkit
======================================

A lightweight helper package to handle translations using Google Translate API.

1.0.0(1y ago)19.0k↑6891.7%[1 PRs](https://github.com/gabrielesbaiz/google-translate-toolkit/pulls)MITPHPPHP ^8.0CI failing

Since Mar 3Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/gabrielesbaiz/google-translate-toolkit)[ Packagist](https://packagist.org/packages/gabrielesbaiz/google-translate-toolkit)[ Docs](https://github.com/gabrielesbaiz/google-translate-toolkit)[ GitHub Sponsors]()[ RSS](/packages/gabrielesbaiz-google-translate-toolkit/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (1)Dependencies (9)Versions (3)Used By (0)

GoogleTranslateToolkit
======================

[](#googletranslatetoolkit)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0b35f102b5792d61cc05686303b1518cd283a59a179396d8379cdf24287d2e33/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6761627269656c65736261697a2f676f6f676c652d7472616e736c6174652d746f6f6c6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gabrielesbaiz/google-translate-toolkit)[![Total Downloads](https://camo.githubusercontent.com/2012573023e9e691b23dc7b1cf5c0e707fb238d40a7beaad02090be54f5ab87f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6761627269656c65736261697a2f676f6f676c652d7472616e736c6174652d746f6f6c6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gabrielesbaiz/google-translate-toolkit)

A lightweight helper package to handle translations using Google Translate API.

Original code from [JoggApp/laravel-google-translate](https://github.com/JoggApp/laravel-google-translate)

Features
--------

[](#features)

- ✅ Basic translation
- ✅ Advanced translation
- ✅ Detect language
- ✅ Batch detect language
- ✅ Batch detect language
- ✅ Batch translation
- ✅ Get available translations for a given text

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

[](#installation)

You can install the package via composer:

```
composer require gabrielesbaiz/google-translate-toolkit
```

You can publish the config file with:

```
php artisan vendor:publish --tag="google-translate-toolkit-config"
```

This is the contents of the published config file:

```
return [
    /*
     * The ISO 639-1 code of the default source language.
     */
    'default_source_translation' => 'en',

    /*
     * The ISO 639-1 code of the language in lowercase to which
     * the text will be translated to by default.
     */
    'default_target_translation' => 'en',

    /*
     * Api Key generated within Google Cloud Dashboard.
     */
    'api_key' => env('GOOGLE_TRANSLATE_API_KEY'),
];
```

Usage
-----

[](#usage)

```
$googleTranslateToolkit = new Gabrielesbaiz\GoogleTranslateToolkit();

echo $googleTranslateToolkit->translate('Hello world');
```

Using facade:

```
use GoogleTranslateToolkit;

GoogleTranslateToolkit::translate('Hello world');
```

Available Methods
-----------------

[](#available-methods)

- `GoogleTranslateToolkit::detectLanguage(string $text): array` - Detect the language.
- `GoogleTranslateToolkit::detectLanguage(array $texts): array` - Detect the language.
- `GoogleTranslateToolkit::translate(string $text): array` - Translate the given text.
- `GoogleTranslateToolkit::translate(array $texts): array` - Translate the given text.
- `GoogleTranslateToolkit::justTranslate(string $text)): string` - Translate the given text.
- `GoogleTranslateToolkit::getAvailableTranslationsFor('en'): array` - Get all the available translations from 'Google Translation' for a particular language by passing its language code.
- `GoogleTranslateToolkit::unlessLanguageIs('en', string $text): array` - Translate unless the language is same as the first argument. It accepts an optional third argument which is the language code you want the string to be translated in. You can specify the default option in the config file. If the languages are same, the input string is returned as it is, else an array is returned containing the translation results.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Jogg](https://github.com/Jogg)
- [Gabriele Sbaiz](https://github.com/gabrielesbaiz)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance65

Regular maintenance activity

Popularity27

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

488d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/97040fb60637d4b81897347524bc9343ffa6b978d4b19c0c28ea0823e2a1752b?d=identicon)[gabrielesbaiz](/maintainers/gabrielesbaiz)

---

Top Contributors

[![gabrielesbaiz](https://avatars.githubusercontent.com/u/22818698?v=4)](https://github.com/gabrielesbaiz "gabrielesbaiz (2 commits)")

---

Tags

laravelGabriele Sbaizgoogle-translate-toolkit

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/gabrielesbaiz-google-translate-toolkit/health.svg)

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M100](/packages/dedoc-scramble)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[elegantly/laravel-translator

All on one translations management for Laravel

6333.1k](/packages/elegantly-laravel-translator)

PHPackages © 2026

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