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

ActiveLibrary

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

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

1.0.0(1y ago)12.4k↑850%MITPHPPHP ^8.0CI failing

Since Mar 3Pushed 1y 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 1mo ago

READMEChangelog (1)Dependencies (9)Versions (2)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

32

—

LowBetter than 72% of packages

Maintenance44

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

442d 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

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)

PHPackages © 2026

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