stichoza/google-translate-php
Free, unofficial Google Translate API client for PHP 8+. Translate text between languages with simple methods, auto language detection, supported languages list, parameter preservation, raw responses, custom URL/token generator, and configurable HTTP client.
Install via Composer: composer require stichoza/google-translate-php. The package provides a simple, static-based translator class with no configuration needed for basic usage. Start by instantiating the translator: $translator = new Stoichoza\GoogleTranslate\TranslateClient();, then translate text: $translated = $translator->translate('Hello world', 'es');. The first argument is the text, the second is the target language code (ISO 639-1). For detecting language, use $translator->detect('Hola mundo');. Check the README.md in the repo for full list of supported languages and examples.
translate() calls to avoid repeated network requests for identical text.TranslationService::translateText($text, $to, $from = null)).auto or be inaccurate for short text—always validate detected results in sensitive workflows.$translator->getLastResponse() or catch GuzzleHttp\Exception\RequestException to capture HTTP-level issues.How can I help you explore Laravel packages today?