beeyev/yandex-translate

This package is abandoned and no longer maintained. No replacement package was suggested.

Online service for machine translation for over 40 languages.

v2.0.1 2016-02-27 19:30 UTC

This package is not auto-updated.

Last update: 2020-06-28 16:20:18 UTC


README

Latest Version on Packagist Software License Total Downloads

This system is like Bing Translator or Google translate, but api is free for use and without strict limits. API offers text translation features for over 30 languages.

API reference in English / Russian

Don't forget to Get yor own API key

Requirements

  • PHP 5.3 or higher
  • cURL

Install

Via Composer

$ composer require beeyev/yandex-translate

Usage

use Beeyev\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 (\Beeyev\YaTranslate\TranslateException $e) {
    //Handle exception
}

License

The MIT License (MIT). Please see License File for more information.