- Does aurawindsurfing/google-translate work with Laravel 10 or Laravel 11?
- The last tagged release dates from December 2021, so its composer.json most likely constrains illuminate/support and guzzlehttp/guzzle to Laravel 8/9-era versions and PHP 7.4 to 8.0. Check those constraints against your target Laravel version before you commit; on Laravel 10 or 11 expect to widen them in a fork or submit a composer.json pull request. There is no evidence of recent maintenance, so plan for the possibility that you own the upgrade path yourself.
- How do I install and configure aurawindsurfing/google-translate in a Laravel app?
- Run composer require aurawindsurfing/google-translate, then publish the package config and set your Google Cloud API key, typically through a GOOGLE_TRANSLATE_API_KEY environment variable rather than a committed config file. Laravel package auto-discovery registers the service provider and facade, so you can start calling it once the key is in place. A first successful call usually takes an afternoon; the real effort is verifying version compatibility.
- How do I translate a string or array of strings with the Google Translate facade in Laravel?
- Resolve the facade and pass a string or an array of strings with a target language code, plus an optional source language if you do not want Google to detect it. The package is a thin wrapper over the v2 REST endpoint, so it returns translated text synchronously within the request. Wrap it behind your own Translator contract so you can swap the adapter later without touching call sites.
- Does this package support glossaries, batch translation, or AutoML custom models?
- No. It targets the Google Cloud Translation v2 Basic REST endpoint with API-key authentication, and glossaries, batch or document translation, and AutoML custom models are v3-level features. Those require service-account credentials and a different client. If they are requirements, budget for the official google/cloud-translate PHP client instead.
- What happens when the Google Translate API returns a 429 or 5xx error or times out?
- The technical evaluation found no clear evidence that this wrapper implements retry with backoff, configurable timeouts, or quota-aware batching. In a synchronous web request an unhandled Google 5xx or timeout becomes a user-facing error, and a naive retry loop can multiply billable characters. Decide your fallback behaviour explicitly, such as returning the original text or a cached value, and wrap the call in your own timeout and retry logic.
- How much does the Google Translate v2 API cost and how do I control spend?
- v2 bills per character, roughly $20 per million characters beyond the monthly free tier, so an uncached call on every page render scales cost linearly with traffic. Cache translations keyed by source text, target language, and source language, and avoid re-translating the same UI strings on each request. Also respect the per-request character limit on the v2 endpoint by chunking large inputs.
- Is it safe to send user content or PII through this package?
- Message content leaves your infrastructure and is sent to Google, and the package itself provides no redaction, data-residency controls, or compliance safeguards. For PII, customer content, or regulated data you need legal or DPO sign-off before enabling it. Restrict the API key by API, IP, or HTTP referrer, and keep it out of version control and application logs.
- What should I use instead of this package for production-grade translation?
- The official google/cloud-translate PHP client is the maintained option, using service-account credentials and exposing v3 features such as glossaries, batch translation, and AutoML models. It costs more setup effort but gives you a supported upgrade path and a stronger auth model. Keep this package only as a first adapter when your needs are simple, synchronous, low-volume string translation.
- Is this package actively maintained, and does it have tests or CI?
- It is a single-maintainer package with around 11 stars and a last release in December 2021, and there is no visible test suite, CI pipeline, static analysis, or security policy. The source is small, so read it before putting production credentials in it. Assume you may need to fork it into your own namespace to patch a Guzzle CVE or a Laravel major upgrade.
- How do I rotate the Google Translate API key without redeploying?
- Keep the key in an environment variable or secrets manager read at runtime, not hard-coded in a published config file, so rotation is a secret update rather than a code change. API keys are bearer-like credentials with no per-tenant scoping, so restrict each one by API, IP, or HTTP referrer and rotate on a schedule. If you use config caching, re-run config:cache after changing the value so the new key is picked up.