haltuf/deepl-php-api

PHP 不官方的 DeepL API 包装器

0.0.1 2021-05-12 09:43 UTC

This package is auto-updated.

Last update: 2024-08-29 05:44:00 UTC


README

example workflow

非官方、无依赖的用于调用 DeepL API 的库。需要 curl 扩展。支持 PHP >= 7.1,也适用于 PHP 8.0。

目前处于开发中。适用于基本用例,尚不支持 xml 参数。

安装

composer require haltuf/deepl-php-api

使用方法

创建 Api 对象并调用 translate 方法。

use Haltuf\DeepL\Api;
use Haltuf\DeepL\Language;

$api = new Api('my_key');
$translation = $api->translate('Text to be translated', Language::CZECH, Language::ENGLISH);

echo $translation->getText();

输出: 要翻译的文本