承接 businessprocess/translation-client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

businessprocess/translation-client

最新稳定版本:2.1.1

Composer 安装命令:

composer require businessprocess/translation-client

包简介

Client for translation API

README 文档

README

Latest Stable Version Total Downloads Software License

Translate API is a PSR-compatible PHP HTTP client for working with translate API.

API Documentation

Installation

The recommended way to install Translate API client is through Composer.

# Install Composer
curl -sS https://getcomposer.org/installer | php

Next, run the Composer command to install the latest stable version of Guzzle:

composer require pervozdanniy/translation-client

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

You can then later update Guzzle using composer:

composer update

Usage

$options = [
    'login' => '<YOUR_LOGIN>',
    'password' => '<YOUR_PASSWORD>',
];
// you can pass any storage you want that implements \Psr\SimpleCache\CacheInterface
$client = new \Translate\ApiClient($options, new \Translate\Storage\ArrayStorage);
$response = $client->request('GET', 'users');

echo $response->getStatusCode(); # 200
echo $response->getHeaderLine('content-type'); # 'application/json; charset=utf8'
echo $response->getBody(); # '{"items": [{"uuid": ...}'

Aliases

Client also resolves aliases, received from login request:

$response = $client->request('GET', 'users/{userUuid}/projects');

For authenticated user 2 aliases are available by default: userUuid and authToken

You can add your own aliases using:

$client->setAlias('projectUuid', '<PROJECT_UUID>');
// use user-defined alias
$response = $client->request('GET', 'projects/{projectUuid}/languages');

Available Options

Option Description Default value
login Your API login (required) null
password Your API password (required) null
api API base uri http://dev-api.translate.center/api/v1/
maxAttempts Number of attempts to reauthenticate to API on 401 response code 3

统计信息

  • 总下载量: 6.66k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-04