prihod / promt-translate
PROMT 翻译 API 的客户端
v1.0
2021-04-28 18:17 UTC
Requires
- php: >=5.3
- ext-curl: *
README
通过 Composer 安装此包。
从终端运行 Composer require 命令
composer require prihod/promt-translate
使用示例
<?php require_once(dirname(__FILE__) . '/vendor/autoload.php'); use Prihod\Translate\Translator; use Prihod\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 }