onesky/api-library-php5
Composer 安装命令:
composer require onesky/api-library-php5
包简介
PHP interface for OneSky Platform API
README 文档
README
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
onesky/api-library-php5 适用场景与选型建议
onesky/api-library-php5 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.18M 次下载、GitHub Stars 达 19, 最近一次更新时间为 2014 年 12 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 onesky/api-library-php5 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 onesky/api-library-php5 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.18M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 19
- 点击次数: 20
- 依赖项目数: 10
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2014-12-11