picatic / php-api
访问 Picatic API 的 PHP 包装器
v1.0.12
2015-04-28 20:49 UTC
Requires
- php: >=5.3
- ext-curl: *
- jakeasmith/http_build_url: *
README
你需要知道的事
- 一切都有接口,一切都可以插件化
- 为了避免静态,我们几乎不做静态,这样测试更容易
- 由于我们反对静态方法,因此有一些奇怪的包装函数/类
- 我们打破了静态和实例方法在那些级别上操作的理想。
我们的“静态”方法以“class”开头:classRateLookup
在某些特殊情况下,我们以“instance”开头实例方法。通常只有当存在同名“class”方法时。
Composer
您可以通过将 "picatic/php-api": "dev-master"
添加到“require”中,包括此包的最新版本。
如何使用
获取 API 实例
$picaticInstance = PicaticAPI::instance();
使用您的密钥配置 API
$picaticInstance->setApiKey('sk_live_123');
查找事件
$event = PicaticAPI::instance()->factory()->modelCreate('Event')->find(34641);
这将返回 Picatic_Event 模型的实例。如果您想将其作为关联数组处理,可以调用 getValues
返回一个关联数组。
$eventAssoc = $event->getValues();
查找一系列事件
$events = PicaticAPI::instance()->factory()->modelCreate('Event')->findAll(array('user_id'=>6679));
更新事件
$event['description'] = 'This is going to rock';
$event->save();