Search by

nowo-tech / google-translate-php-bundle

HecFranco

Symfony bundle wrapping stichoza/google-translate-php with named profiles, FrankenPHP worker-safe reset, and configurable HTTP timeouts.

Package info

github.com/nowo-tech/GoogleTranslatePhpBundle

Documentation

Type:symfony-bundle

pkg:composer/nowo-tech/google-translate-php-bundle

Fund package maintenance!

HecFranco

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.4.1 2026-11-12 13:19 UTC

README

CI Packagist Version Packagist Downloads License PHP Symfony GitHub stars Coverage

⭐ Found this useful? Install from Packagist · Give it a star on GitHub so more developers can find it.

Symfony bundle wrapping stichoza/google-translate-php with named profiles, configurable HTTP timeouts, and FrankenPHP worker compatibility (ResetInterface).

FrankenPHP Friendly Worker Mode

This bundle is FrankenPHP worker mode friendly.

Features

  • Named profiles (default_profile + profiles) for target/source languages, Guzzle timeouts, client, URL, and preserve_parameters.
  • Worker-safe translator: clears mutable state between requests, Messenger messages and console commands under FrankenPHP worker / long-running PHP — including when the kernel is kept alive and the services resetter does not run (ResetTranslatorsOnRequestSubscriber).
  • Defensive extractParameters(): per-call placeholder counter (no reliance on upstream static $index).
  • REQ-RUNTIME-001 timeouts: timeout + connect_timeout on every profile.

Version policy

The Composer package name is nowo-tech/google-translate-php-bundle. Source code and issues are in the GitHub repository nowo-tech/GoogleTranslatePhpBundle.

We follow Semantic Versioning. See Changelog for release notes. Security support by major version is described in the Security policy.

Quick example

# config/packages/nowo_google_translate_php.yaml
nowo_google_translate_php:
    default_profile: default
    profiles:
        default:
            target: es
            timeout: 10.0
            connect_timeout: 5.0
use Nowo\GoogleTranslatePhpBundle\Contract\GoogleTranslatorInterface;

final class MyService
{
    public function __construct(
        private readonly GoogleTranslatorInterface $translator,
    ) {
    }

    public function run(string $text): ?string
    {
        return $this->translator->translateTo($text, 'es');
    }
}

Standard Symfony hosts and DDD / hexagonal hosts (domain port implemented on GoogleTranslatorInterface, bundle exceptions only): see USAGE — Inject the translator.

Requirements

  • PHP >= 8.2, < 8.6
  • Symfony 6.4, 7.4, 8.0, or 8.1 (see composer.json; CI exercises 6.4, 7.4, 8.0, and 8.1)
  • stichoza/google-translate-php ^5.1

Disclaimer

Upstream scrapes Google Translate (unofficial). Prefer Cloud Translation / DeepL / LibreTranslate for production. See also nowo-tech/translation-yaml-tools-bundle.

Documentation

Additional documentation

Tests and coverage

  • Tests: PHPUnit (PHP)
  • PHP: 100%
  • TS/JS: N/A
  • Python: N/A

License

MIT. See LICENSE.