Client for Yandex.Translate API
Clone or download
Latest commit 3a53fc1 Aug 24, 2015
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Use POST-request Aug 23, 2015
.gitignore Initial commit May 19, 2014
LICENSE Initial commit May 19, 2014
README.md Update README.md Jul 27, 2015
composer.json Update meta information Jul 27, 2015

README.md

Yandex.Translate API

Latest Stable Version Total Downloads Latest Unstable Version License

Api reference

Versioning

Package version corresponds to the version of the API.

Installation

Add into your composer.json:

{
  "require": {
    "yandex/translate-api": "1.5.x"
  }
}

Usage

Get your own api key

use Yandex\Translate\Translator;
use Yandex\Translate\Exception;

try {
  $translator = new Translator($key);
  $translation = $translator->translate('Hello world', 'en-ru');

  echo $translation; // Привет мир

  echo $translation->getSource(); // Hello world;

  echo $translation->getSourceLanguage(); // en
  echo $translation->getResultLanguage(); // ru
} catch (Exception $e) {
  // handle exception
}

License

MIT