Git Product home page Git Product logo

api-library-php5's Introduction

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

api-library-php5's People

Contributors

bernardosilva avatar brandesign avatar k3nn7 avatar peterjaap avatar skolodyazhnyy avatar valorin avatar vlmh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.