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.
Full Changelog: https://github.com/Stichoza/google-translate-php/compare/v5.2.0...v5.3.0
ext-dom)Full Changelog: https://github.com/Stichoza/google-translate-php/compare/v5.1.4...v5.2.0
${\d} delimiter with #{\d} to resolve currency bugs by @kylemilloy in https://github.com/Stichoza/google-translate-php/pull/202Full Changelog: https://github.com/Stichoza/google-translate-php/compare/v5.1.3...v5.1.4
preserveParameters() method to preserve specific parameters during translation. Users can now retain placeholders like :name or :count within localization files or templating engines, preventing their translation. Usage can be found in preserving parameters section of documentation. - #199. Thanks @kylemilloy 🎉As of v5.1.0 concrete exceptions are available in \Stichoza\GoogleTranslate\Exceptions namespace:
LargeTextException If the requested text is too large to translate.RateLimitException If Google has blocked you for excessive amount requests.TranslationRequestException If any other HTTP related error occurs during translation.TranslationDecodingException If the response JSON cannot be decoded.All concrete exceptions are backwards compatible, so if you were using older versions, you won't have to update your code.
TranslationDecodingException extends UnexpectedValueException, while LargeTextException, RateLimitException and TranslationRequestException extend ErrorException that was used in older versions (<5.1.0) of this package.
Finally a good answer to #70
Updated package to require PHP 8 as PHP 7.4 reached its end of life yesterday.
setOptions() method accepts only arrays, parameter is not nullable anymore. Likelihood of impact in low.webapp client to gtx for better quality of translation. #163, Thanks @hennosetClient() method to switch between gtx and webapp clients (Default is gtx).Preserve HTTP error codes in ErrorException #160 #161
Add PHP 8 Support
Fixes errors on old version. Please upgrade to new version of this package tho, 3.2 is not supported.
This is a major update. Please read docs before updating from v3.2 to v4.0.
TranslateClient to simply GoogleTranslate.trans() and non-static translate() methods.>=5.5.0.~6.0.getLastDetectedSource() can be called both statically and non-statically.$options for advanced configuration of Guzzle HTTP client. (@vkollin)
getLastDetectedSource()Totally refacted the whole code.
Readme and docs soming soon
Fixed PSR-4 support
This package has been added to Composer package manager :sunglasses: See the readme for installation instructions.
How can I help you explore Laravel packages today?