onesky/api-library-php5 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

onesky/api-library-php5

最新稳定版本:v1.0.5

Composer 安装命令:

composer require onesky/api-library-php5

包简介

PHP interface for OneSky Platform API

README 文档

README

Build Status Code Coverage

Onesky PHP5 API Library

PHP5 library for OneSky API

Requirements

  • PHP 5.1 or higher
  • CURL extension

Installation

Install the latest version with composer require onesky/api-library-php5

How to use

Create instance

use Onesky\Api\Client;

$client = new Client();

Set API key and secret

$client->setApiKey('<api-key>')->setSecret('<api-secret>');

Way to make request

// resource   => name of resource in camelcase with 's' tailing such as 'projectTypes', 'quotations', 'importTasks'
// action     => action to take such as 'list', 'show', 'upload', 'export'
// parameters => parameters passed in the request including URL param such as 'project_id', 'files', 'locale'
$client->{resource}('{action}', array({parameters}));

Sample request and get response in array

// list project groups
$response = $client->projectTypes('list');
$response = json_decode($response, true);

// show a project
$response = $client->projects('show', array('project_id' => 999));
$response = json_decode($response, true);

// upload file
$response = $client->files('upload', array(
    'project_id'  => 999,
    'file'        => 'path/to/string.yml',
    'file_format' => 'YAML',
    'locale'      => 'fr'
));
$response = json_decode($response, true);

// export translation
$response = $client->translations('export', array(
    'project_id' => 999,
    'locale'     => 'ja',
    'source_file_name' => 'string.yml'
));
file_put_contents('path/to/file', $response);

// create order
$response = $client->orders('create', array(
    'project_id' => 999,
    'files'      => 'string.yml',
    'to_locale'  => 'de'
));
$response = json_decode($response, true);

How to contribute

Or pick one of the issues and create a PR to solve it.

How to run tests

Note: need to install dependencies using composer to have phpunit.

vendor/bin/phpunit

统计信息

  • 总下载量: 1.13M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 19
  • 点击次数: 1
  • 依赖项目数: 10
  • 推荐数: 1

GitHub 信息

  • Stars: 19
  • Watchers: 14
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-12-11