2017 © Pedro Peláez
 

library apimapper

API wrapper

image

rgsystemes/apimapper

API wrapper

  • Wednesday, April 26, 2017
  • by sandvige
  • Repository
  • 3 Watchers
  • 3 Stars
  • 2,596 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 1 Versions
  • 7 % Grown

The README.md

Build Status, (*1)

ApiMapper is a simple wrapper arround Buzz to perform API calls., (*2)

Dependencies

This library requires pecl_http to be installed and enabled., (*3)

Using APT (Debian/Ubuntu) :, (*4)

sudo apt-get install -y php-pecl-http

Using PEAR :, (*5)

sudo pecl install --alldeps pecl_http

Getting started

<?php

$browser = new Buzz\Browser();
$mapper = new ApiMapper\ApiMapper($browser, 'https://api.baseurl.com/api');

$mapper->addEventListener(new AuthenticationListener($sessionManager));
$mapper->addQueryParameter('apiKey', new ApiKeyProvider('someApiKey'));
$mapper->addRouteParameter('{token}', new AuthenticationProvider($sessionManager));

// https://api.baseurl.com/api/auth?apiKey=someApiKey&userName=$userName&password=$password
$response = $mapper->get('auth', array(
    "userName" => $userName,
    "password" => $password
));

// There is no need here to provide the token since it has been
// wrapped when calling auth.
// https://api.baseurl.com/api/1234/some/obscure/12/route
$response = $mapper->get('{token}/some/obscure/{someId}/route', array(
    "{someId}" => 12
));

The Versions

26/04 2017

dev-master

9999999-dev https://github.com/rgsystemes/apimapper

API wrapper

  Sources   Download

MIT

The Requires

 

api curl http client buzz