Skip to content

Latest commit

 

History

History
112 lines (77 loc) · 2.78 KB

File metadata and controls

112 lines (77 loc) · 2.78 KB

FancyHands PHP Wrapper

PHP Wrapper for the FancyHands API originally written by Charles Zink (Github). (So thank him if it's helpful)

It has been updated for new API calls by Ted Roden Github (so blame him if it's broken)

Requirements

The only requirement, other than PHP, is the pecl OAuth extension

Installing pecl/oauth on Ubuntu/Debian:

sudo apt-get install pecl
sudo pecl install oauth

Installing pecl/oauth a Mac

Install pecl

sudo pecl install oauth

Usage

Complete usage examples in Example.php

Making an API Request

Getting everything ready.

// API Keys
$apiKey 	= 'YOUR_API_KEY';
$apiSecret 	= 'YOUR_API_SECRET';

// Initialize the API
$FancyHands = new FancyHands($apiKey, $apiSecret);

Create a standard request:

// create a standard request that expires tomorrow
$expire = strtotime("+1 day");
$std = $FancyHands->standard_create("Standard Request", Do something for me...", 3.0, $expire);

Add a message to the standard request:

$FancyHands->standard_messages_create($std->key, "I'm going to cancel this request");

Cancel it:

if($FancyHands->cancel($r->key)) {
   print("Canceled!");
}

Get a list of all expired requests:

$query = $FancyHands->standard_get(null, $FancyHands::STATUS_EXPIRED);
foreach($query->requests as $r) {
    print("[" . $r->status . "] " . $r->title . " (" . $r->uniq . ")\n");
}

Get a single request:

$request = $FancyHands->standard_get($std->key);

Create a custom request:

$customFields = array(
    array(
        'type' => 'text',
        'required' => false,
        'label' => "Test Field",
        "description" => "Test Field Description",
        "order" => 0,
        "field_name" => "test_field"
    )
);
$expire = strtotime("+1 day");
$request = $FancyHands->custom_create("PHP Custom Test", "PHP Custom Test...", 1, $customFields, $expire);

Other PHP Versions

Support

License

MIT