Much to come including proper documentation and tests.
A developer can interact with the Hyperpublic API and this PHP library by using a number of methods on a Hyperpublic object. The available methods are show
, find
, and create
. A Hyperpublic object can be either a person (people
), a place (places
), or a thing (thing
).
First we need to create a connection to Hyperpublic using your API keys.
$hyperpublic = new Hyperpublic(CONSUMER_KEY,CONSUMER_SECRET);
Returns a person with the ID 4.
$me = $hyperpublic->people->show(4);
You can now easily access any available information about me.
This is how you get my name.
echo $me->headline;
And this is how you get my tags.
foreach($me->tags as $tag) {
echo $tag;
}
The following returns a search for people tagged “developer”.
$developers = $hyperpublic->people->find(array('tags' => 'developer'));
We can now easily retrieve photographs of the developers.
foreach($developers as $developer){
echo "<img src='{$developer->image->src_large}'/>";
}
Say we want to narrow that search to a neighborhood and return no more than 10.
$brooklynDevs = $hyperpublic->people->find(array('tags' => 'developer', 'location[neighborhood]' => 'williamsburg', 'limit' => '10'));
Let’s create a place.
$myHouse = $hyperpublic->place->create(array('name' => 'my house','category' => 'home','tag_list' => '["cat","nintendo wii","coffee","brooklyn"]'));
Check out example.php
for more detailed examples.
Please join the Hyperpublic API mailing list for the most recent information. Further documentation may be found at http://developers.hyperpublic.com.