enupal / yandex-translate
Online service for machine translation for over 40 languages.
Installs: 50 855
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: >=5.3.0
- ext-curl: *
This package is auto-updated.
Last update: 2024-11-29 05:51:32 UTC
README
Yandex API offers text translation features for over 30 languages.
API reference in English
Requirements
- PHP 5.3 or higher
- cURL
Install
Via Composer
$ composer require enupal/yandex-translate
Usage
use Enupal\YaTranslate\Translate; try { $tr = new Translate('yourApiKey'); $result = $tr->translate("Hey baby, what are you doing tonight?", 'fr'); echo $result; // Hey bébé, tu fais quoi ce soir? echo $result->sourceText(); // Hey baby, what are you doing tonight? echo $result->translationDirection(); // en-fr var_dump($result->translation()); // array (size=1) // 0 => string 'Hey bébé, tu fais quoi ce soir?' } catch (\Enupal\YaTranslate\TranslateException $e) { //Handle exception }