Skip to content

enupal/yandex-translate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yandex Translate

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
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages