yandex / translate-api
Client for Yandex.Translate API
Installs: 1 835 159
Dependents: 16
Suggesters: 1
Security: 0
Stars: 132
Watchers: 19
Forks: 27
Open Issues: 6
Requires
- php: >=5.3
- ext-curl: *
This package is not auto-updated.
Last update: 2024-09-30 04:33:19 UTC
README
Versioning
Package version corresponds to the version of the API.
Installation
Add into your composer.json
:
{ "require": { "yandex/translate-api": "1.5.x" } }
Usage
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 }