dev-master
9999999-dev https://github.com/joeyrivera/badgeville-phpBadgeville Cairo SDK for PHP
MIT
The Requires
- php >=5.4.0
- guzzlehttp/guzzle 4.*
The Development Requires
by Joey Rivera
php sdk badgeville cairo
Wallogit.com
2017 © Pedro Peláez
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)
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');
considering the following changes * so all classes are singular named, (*9)
Badgeville Cairo SDK for PHP
MIT
php sdk badgeville cairo