lingvanex/php-translator-api
Composer 安装命令:
composer require lingvanex/php-translator-api
包简介
Lingvanex Translator, a cutting-edge cloud-based neural machine translation service
README 文档
README
Discover the Power of Lingvanex Translator Service
Unlock the potential of your applications with Lingvanex Translator, a cutting-edge cloud-based neural machine translation service. Compatible with any operating system, Lingvanex Translator enables the creation of intelligent, multi-lingual solutions for all supported languages. Whether you are looking for a PHP translation API, or need to translate text efficiently, Lingvanex offers a powerful solution for developers.
With Lingvanex, you can effortlessly translate both text and HTML pages, enhancing your global reach and communication capabilities. Our free translation API for PHP allows you to start integrating translation functionality into your projects quickly and easily. Additionally, our PHP library for translation ensures smooth integration with minimal setup. You can also explore a specialized PHP language translation library, making it easy to build language tools.
Explore the capabilities of the Lingvanex Cloud API and learn more about our Secure On-Premise Machine Translation. This versatile tool provides developers with a PHP library to translate text, offering a robust way to handle translations in your application. For those seeking a free PHP translation API, Lingvanex offers solutions that meet all levels of demand.
How to get the authentication key
Before using the API you need to create the account and then generate the API key at the bottom of the page. You must use this authorization key to authorize requests.
Installation
You can install the library using this command:
composer require lingvanex/php-translator-api
Requirements
- PHP version >= 8.2
Getting the list of languages
To retrieve the list of languages, perform a GET request with the authentication key as follows:
<?php
$url = "https://api-b2b.backenster.com/b1/api/v3/getLanguages?platform=api&code=en_GB";
$ch = curl_init($url);
$headers = [
"Accept: application/json",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
} else {
// Print the response
echo $response;
}
curl_close($ch);
?>
Options:
url: https://api-b2b.backenster.com/b1/api/v3/getLanguagesplatform: apiAuthorization: The key must be obtained in advancecode: the language code in the format “language code_code of the country”, which is used to display the names of the languages. The language code is represented only in lowercase letters, the country code only in uppercase letters (example en_GB, es_ES, ru_RU etc). If this option is not present, then English is used by default.
Translate PHP Text
This POST method translates text and HTML single string or arrays with the authentication key. Also it performs transliteration, language auto detection.
<?php
$url = "https://api-b2b.backenster.com/b1/api/v3/translate";
$payload = [
"platform" => "api",
"from" => "en_GB",
"to" => "de_DE",
"data" => "Some text",
"translateMode" => "html",
"enableTransliteration" => true
];
$jsonPayload = json_encode($payload);
$ch = curl_init($url);
$headers = [
"Accept: application/json",
"Content-Type: application/json",
];
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonPayload);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
} else {
// Print the response
echo $response;
}
curl_close($ch);
?>
Options:
url: https://api-b2b.backenster.com/b1/api/v3/translateplatform: apiAuthorization: The key must be obtained in advancefrom: the language code in the format “language code_code of the country” from which the text is translated. The language code is represented only in lowercase letters, the country code only in uppercase letters (example en_GB, es_ES, ru_RU and etc.). If this parameter is not present, the auto-detect language mode is enabled.to: language code in the format “language code_code of the country” to which the text is translated (required)data: data for translation.translateMode: Describe the input text format. Possible value is "html" for translating and preserving html structure. If the value is not specified or is other than "html" then plain text is translating.enableTransliteration: If true response includes sourceTransliteration and targetTransliteration fields.
Issues
If you are having problems using the library, please contact us.
lingvanex/php-translator-api 适用场景与选型建议
lingvanex/php-translator-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 10 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 lingvanex/php-translator-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lingvanex/php-translator-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-14