• Stars
    star
    132
  • Rank 273,350 (Top 6 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Client for Yandex.Translate API

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