webazon / yandex-translator
The unofficial PHP API library of Yandex.Translate. Version 2.
Requires
- php: ^8.2
- ext-curl: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Неофициальная API PHP библиотека Яндекс.Переводчика. Версия 2.
Для начала реализации необходимо настроить сервисный аккаунт на Яндекс.Облаке, определить ID каталога и получить сервисный API-ключ.
Установка
Можно установить используя менеджер пакетов Composer
$ composer require webazon/yandex-translator
или скачать пакет с GitHub
Инициализация и использование
require __DIR__ . '/vendor/autoload.php'; $translator = new Translator(["folder_id"=> "<ID каталога>", "ApiKey"=>'<API-ключ>']); $translate = $translator->Translate('Hello, World','en-ru'); $text = $translate -> text;
Список поддерживаемых языков можно получить командой:
$translate = $translator->listLanguages();
или в файле JSON в корне проекта.
Unofficial PHP API library Yandex.Translate. Version 2.
To start the implementation, you need to set up a service account on Yandex.Cloud, determine the folder ID and get the service API key.
Installation
Can be installed using the package manager Composer
$ composer require webazon/yandex-translator
or download the package from GitHub
Initialization and usage
require __DIR__ . '/vendor/autoload.php'; $translator = new Translator(["folder_id"=> "<Catalog ID>", "ApiKey"=>'<API-key>']); $translate = $translator->Translate('Hello, World','en-ru'); $text = $translate -> text;
The list of supported languages can be obtained using the command:
$translate = $translator->listLanguages();
or in the file JSON at the root of the project.