2017 © Pedro Peláez
 

library badgeville-php

Badgeville Cairo SDK for PHP

image

joeyrivera/badgeville-php

Badgeville Cairo SDK for PHP

  • Wednesday, August 27, 2014
  • by joeyrivera
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

#Badgeville Cairo SDK for PHP

version 0.1 - NOT STABLE, (*1)

This ia a work in progress and lots of things will be changing still. Hopefully it won't take too long to get a beta ready. The idea is to provide a library that is easy to use to interact with the Cairo API., (*2)

Usage

keep in mind functionality will probably change until beta, (*3)

To install via composer:, (*4)

{
    "require": {
        "joeyrivera/badgeville-php": "dev-master"
    }
}

The best way to get started is to test the find/findall utility under examples/index.php. To use, create a copy of examples/config.php.dist and save it as examples/config.php. Next update the params array with your info so it looks like:, (*5)

$params = [
    'url' => 'https://sandbox.badgeville.com/cairo',
    'apiVersion' => 'v1',
    'apiKey' => '234lkj23l4kj23l4l2j34lk23j4lk23l4', // get this from your badgeville dashboard
    'siteId' => '23k4lj23kl4j23lkj4', // get this from your badgeville dashboard
];

Now you can direct your brower to the examples folder and use the utility., (*6)

To start using the library you need create a site instance passing it the site id and setting the client to a GuzzleHttp\Client instance., (*7)

use Badgeville\Api\Cairo\Sites;
$site = new Sites($siteId);
$site->setClient(new GuzzleHttp\Client($params));

Example of site specific calls:, (*8)

$player = $site->players()->find('joey@rivera.com');

$player = $site->players()->find('234lkj234lkj234lkj', [
    'includes' => 'rewards,positions,activities'
]);

$players = $site->players()->findAll();

$player = $site->players()->create([
    'name' => 'Joey Tester2',
    'email' => 'joeyrivera@air-watch.com2'
]);

$player->display_name = 'testing2';
$player->save();

$activity = $site->players('234lkj234lkj234lkj')->activities()->create('logged');

Todos

  • unit testing
  • metadata mapping?
  • monolog
  • decide on exceptions
  • need error handling, resources should indicate what they can do ex: create vs find

considering the following changes * so all classes are singular named, (*9)

The Versions

27/08 2014

dev-master

9999999-dev https://github.com/joeyrivera/badgeville-php

Badgeville Cairo SDK for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

php sdk badgeville cairo