Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
PHP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.settings
src/CityIndex/CIAPI
tests/CityIndex/CIAPI/Test
tools/Veewee
.buildpath
.gitignore
.project
.travis.yml
LICENSE.txt
NOTICE.txt
README.md
Vagrantfile
build.xml
composer.json
composer.lock
phpunit.xml

README.md

CIAPI.PHP

A basic/limited PHP client library for connecting to the CityIndex Trading API.

Status

IncompleteUnsupported

This project has been retired and is no longer being supported by City Index Ltd.

  • if you should choose to fork it outside of City Index, please let us know so we can link to your project

Usage Example

<?php
use CityIndex\CIAPI\Core\CIAPIClient;

// Setup a connection to the API endpoint
$client = new CIAPIClient("https://{REST API ENDPOINT}/", '{APP_KEY}', '{APP_VERSION}');
// Create a session
$client->logIn("{username}", "{password}");
// Retrieve some data
$accountInformation = $client->getAccountInformation();
// Use the data
echo $accountInformation->logonUserName ."\n";
// Delete the session
$client->logOut();

Requirements

CIAPI.PHP requires at least PHP version 5.3.

Furthermore it depends on Requests for PHP, but this dependency is usually handled automatically, see section Installation for details.

Installation

Install via PHP Archive (phar)

NOTE: CIAPI.PHP.phar is currently dysfunctional, so this doesn't work yet!

You can include CIAPI.PHP via a single line as follows:

<?php
require_once 'CIAPI.PHP.phar';

// ...

Install via Composer

NOTE: CIAPI.PHP is not yet published via Composer, so this doesn't work yet!

If you're using Composer to manage dependencies, you will be able to add CIAPI.PHP with it as follows:

{
    "require": {
        "cityindex/ciapi": ">=1.0"
    }
}

Install via archives from BuildHive

You can download a generated source archive:

$ curl -O https://buildhive.cloudbees.com/job/sopel/job/CIAPI.PHP/lastSuccessfulBuild/artifact/build/dist/CIAPI.PHP.tar.gz

Include it in your scripts via PHP autoloading:

<?php
require_once '<PATH TO DOWNLOAD>/vendor/autoload.php';

Install via source from GitHub

You can either clone the repository or download an archive:

$ git clone git://github.com/cityindex/CIAPI.PHP.git

Run the Ant build to fetch dependencies via Composer:

$ ant

Include it in your scripts via PHP autoloading:

<?php
require_once '<PATH TO CLONE>/vendor/autoload.php';
    $ curl https://github.com/cityindex/CIAPI.PHP/tarball/master | tar xzv
    (or)
    $ wget https://github.com/cityindex/CIAPI.PHP/tarball/master -O - | tar xzv

Run the Ant build to fetch dependencies via Composer:

$ ant

Include it in your scripts via PHP autoloading:

<?php
require_once '<PATH TO DOWNLOAD>/vendor/autoload.php';

Development

A couple of preliminary notes on how to build/test the library:

Build

The build is based on Apache Ant and provides the usual targets clean/build/test/dist, e.g.

$ ant dist

Updating the Composer dependencies modifies the source code and ist handled by a dedicated target accordingly:

$ ant update

Test

There are a few unit tests and some integration tests currently, with the latter requiring CIAPI credentials to be available as environment variables, e.g. (the integration tests are skipped if one or both of these are absent):

$ export CIAPI_USERNAME='<username>'    
$ export CIAPI_PASSWORD='<password>'

License

Copyright 2012 City Index Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Something went wrong with that request. Please try again.