aalfiann/google-translate-api-php
Composer 安装命令:
composer require aalfiann/google-translate-api-php
包简介
A PHP class library to make your own Google Translate API for free.
README 文档
README
A PHP class library to make your own Google Translate API for free.
Installation
Install this package via Composer.
composer require "aalfiann/google-translate-api-php:^1.0"
Standar Usage
require_once ('vendor/autoload.php'); use \aalfiann\GoogleTranslate; $lang = new GoogleTranslate(); $lang->source = 'id'; $lang->target = 'en'; $lang->text = 'Selamat datang di kampung halamanku!'; $result = $lang->translate()->getText(); echo $result;
Chain Usage + Make detect source of language automatically
require_once ('vendor/autoload.php'); use \aalfiann\GoogleTranslate; $lang = new GoogleTranslate(); $text = 'Arigatou!'; $result = $lang->setTarget('en')->setText($text)->translate()->getText(); echo $result;
Note:
- If you are not specify the source of language, then Google will detect it automatically.
- You should cache the results, because Google has LIMIT RATE and will block your IP address server if too many request.
统计信息
- 总下载量: 118
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-09-04