1. Go to this page and download the library: Download gino-pane/phpolyglot library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gino-pane / phpolyglot example snippets
$phpolyglot = new PHPolyglot($config, $env);
function translate(string $text, string $languageTo, string $languageFrom = ''): TranslateResponse
function translateBulk(array $text, string $languageTo, string $languageFrom = ''): TranslateResponse
$response = (new PHPolyglot())->translate('Hello world', 'it')->getTranslations(); // [ 0 => Ciao mondo ]
function lookup(string $text, string $languageFrom): DictionaryResponse
function lookup(string $text, string $languageFrom, string $languageTo): DictionaryResponse
$response = (new PHPolyglot)->lookup('Hello', 'en)->getEntries();
$synonyms = implode(", ", $response[0]->getSynonyms());
$output = <<<TEXT
Initial word: {$response[0]->getTextFrom()}
Part of speech: {$response[0]->getPosFrom()}
Transcription: {$response[0]->getTranscription()}
Main alternative: {$response[0]->getTextTo()}
Synonyms: {$synonyms}
TEXT
echo $output
/**
Initial word: hello
Part of speech: noun
Transcription: ˈheˈləʊ
Main alternative: hi
Synonyms: hallo, salut
*/
function spellCheck(string $text, string $languageFrom = ''): SpellCheckResponse
function spellCheckBulk(array $texts, string $languageFrom = ''): SpellCheckResponse