pbousa/php-sdk

PHP Photo Booth Options SDK

dev-master 2014-12-23 10:46 UTC

This package is not auto-updated.

Last update: 2024-09-28 16:25:53 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

Photo Booth Options PHP SDK帮助开发者利用Photo Booth Options API,使用PHP脚本语言构建应用程序。

快速开始

获取给定机器的所有用户

<?php
// Following line not needed if using composer autoloader
require('/path/to/pbousa/php-sdk/src/PboApi/PboApi.php');

$token = 'AABBA';

$client = new \PboApi\Common\Client($token);

$users = $client->machines->get(array('machine_uuid' => 'uuid_of_machine'));

print_r($users);

获取和设置元数据

// Get some meta data
$serialNumber = $machine->getMeta('serial_number');

// Get a meta data group
$cameraData = $machine->getMetas('hardware.camera');


// Update a single meta data entry
$machine->setMeta('my.meta.key', 'this is some revealing information');

// Update multiple meta data entries
$metas = array();

$meta = new stdClass();
$meta->key = 'my.meta.key';
$meta->value = 'this is some revealing information';
$metas[] = $meta;

$meta = new stdClass();
$meta->key = 'other.meta.key';
$meta->value = 'I need this for later';
$metas[] = $meta;

$machine->setMetas($metas);

// You can also chain them like so...
$machine->setMeta('my.meta.key', 'this is some revealing information')
->setMeta('other.meta.key', 'I need this for later')
->setMeta('very.important.data', 'eat breakfast every day');

// Or combine both
$machine->setMeta('my.meta.key', 'this is some revealing information')
->setMetas($metas);

资源