Simple PHP library for talking to Google's Translate API for free.
Install this package via Composer.
composer require ILYAGVC/free-google-translate
Or edit your project's composer.json
to require ILYAGVC/free-google-translateand then run
composer update`.
"require": {
"ILYAGVC/free-google-translate": "^1.0.0"
}
require __DIR__ . 'vendor/autoload.php';
use \ILYAGVC\free-google-translate;
$result = TranslateGoogleFree::Translate("Hello, how are you?", "en", "fa");
if ($result[1] == null) {
echo $result[0]; // سلام، حال شما چطور است؟
} else {
echo $result[1]->getMessage();
}