1. Go to this page and download the library: Download thejano/text-translator 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/ */
thejano / text-translator example snippets
heJano\TextTranslator\GoogleTranslator;
$text = 'Hello World';
$translator = new GoogleTranslator();
$translated = $translator->translate($text,'ckb'); // ckb stands for Kurdish Sorani language
echo $translated; // Prints سڵاو جیهان
# Or Call statically
GoogleTranslator::translate($text,'ckb');
# Translate from Arabic to English
GoogleTranslator::translate('مرحبا بالعالم','en','ar'); // will returns Hello World
new GoogleTranslator(string $sourceLanguage = 'auto', string $targetLanguage = '')
public function _translate(string $text, string $targetLanguage = '', string $sourceLanguage = ''): string;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.