require_once 'vendor/autoload.php'; use Gdn_Translate\Gdn_Translate; // Instantiate Gdn_Translate object $translator = new Gdn_Translate('google'); // Translate string from English to Spanish $translation = $translator->translate('Hello World', 'en', 'es'); echo $translation; // Output: Hola Mundo
require_once 'vendor/autoload.php'; use Gdn_Translate\Gdn_Translate; // Instantiate Gdn_Translate object $translator = new Gdn_Translate('bing'); // Detect language of string $language = $translator->detectLanguage('Bonjour tout le monde'); echo $language; // Output: frIn this example, we again require the autoloader and instantiate a new `Gdn_Translate` object with the Bing Translator service. We then call the `detectLanguage` method to detect the language of a French string. Overall, PHP Gdn Translate is a useful package library for PHP developers who need to translate texts in their applications. It supports multiple translation APIs and provides easy-to-use methods for translation and language detection.