2017 © Pedro Peláez
 

library ixf-client-php

PHP client for RESTful access to the IX-F database

image

euro-ix/ixf-client-php

PHP client for RESTful access to the IX-F database

  • Wednesday, May 14, 2014
  • by barryo
  • Repository
  • 5 Watchers
  • 1 Stars
  • 3,132 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 7 % Grown

The README.md

IXF Database - PHP Client

PHP RESTful interface for the IXF database,, (*1)

Installation

This library is best used with Composer. Just add the following to your composer.json:, (*2)

"require": {
    "euro-ix/ixf-client-php": "dev-master"
}

If you are not using composer, see the demo file for an example list of includes., (*3)

Usage

First, prime the API with the endpoint (official end point to be provided when live) and your credentials:, (*4)

IXF\IXF::setApiBase( 'https://www.example.com/api' );
IXF\IXF::setApiUser( 'guest' );
IXF\IXF::setApiPass( 'guest' );

You can get an array of all IXPs and print their name, short name and latitude / longitude, as follows:, (*5)

$ixps = IXF\ApiResource::all( 'IXP' );

foreach( $ixps as $o )
    echo $o->full_name . '[' . $o->short_name . '] => ' . $o->lat . ', ' . $o->lon . "\n";

You can use skip and limit options as follows:, (*6)

$ixps = IXF\ApiResource::all( 'IXP', [ 'skip' => 10, 'limit' => 5 ] );

The default ordering is by ID., (*7)

You can fetch a specific IXP by id and edit it as follows:, (*8)

$ixp = IXF\ApiResource::retrieve( 'IXP', $id );
$ixp->short_name = 'NEW_SHORTNAME';
$ixp->save();

You can also delete that IXP via:, (*9)

$ixp->delete();

Finally, create an IXP via:, (*10)

$newObjId = IXF\ApiResource::create( 'IXP',
    [
        "full_name" => "Test IXP",
        "short_name" => "TIXP"
    ]
);

$newIXP = IXF\ApiResource::retrieve( 'IXP', $newObjId );

Complete documentation can be found in the wiki., (*11)

Documentation and Tests

See the tests/ for sample test suites which will show how the code works., (*12)

We'll link API documentation when it's uploaded., (*13)

Source / Origin Story

Written by Barry O'Donovan of INEX during the May 2014 euro-ix hackaton in Sheffield, UK., (*14)

Issues and pull requests are welcomed., (*15)

Stripe created a beautiful API for their payment gateway. They open sourced the PHP library under the MIT license. This library is based on that., (*16)

(a few hours later) Hmmmm... beautiful API interface, horrendously coded API library. It was a mistake to use it but that's a bed I've made for myself now. I've stripped 70% of the cruft and it's slightly more palatable., (*17)

The Versions

14/05 2014

dev-master

9999999-dev https://github.com/euro-ix/ixf-client-php

PHP client for RESTful access to the IX-F database

  Sources   Download

MIT

The Requires

  • php >=5.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

ix-f ixp peeringdb