deboorn / rockrmsapi
PHP Rock RMS API 助手
1.0.4
2016-03-11 22:20 UTC
Requires
- guzzlehttp/guzzle: ^6.1
This package is not auto-updated.
Last update: 2024-09-12 00:14:12 UTC
README
Rock RMS Api 助手
PHP 5+ 版本的 Rock RMS Api 允许您的教会 PHP 项目轻松集成 RockRMS.com。基于 Guzzle 6 构建,Rock RMS Api 助手将引导您的集成,使您能够轻松地验证并消费所有 RockRMS REST API 资源。通过基于凭证的验证轻松验证。
- PHP 5+ Rock RMS Api 助手
- 轻松集成您的教会 PHP 项目与 RockRMS.com。
- 许可协议:Creative Commons Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0)
- 请尊重上述许可协议(CC BY-NC 3.0),它严格限制为非商业用途。
- 如果您是教会工作人员或志愿者,此软件包的许可适用于您。
- 有关此软件的问题请联系 daniel.boorn@gmail.com。
- 文件未经 Rock RMS 官方支持。
由
此项目的资金由 OnlineGiving.org 提供。
如何安装
安装 deboorn/rockrmsapi
软件包
$ composer require deboorn/rockrmsapi
用法示例
require 'vendor/autoload.php'; $rock = new RockRMS\Api('admin', 'admin', 'http://rock.rocksolidchurchdemo.com/api/'); ### Authentication // Calling the auth method will fetch a cookie from the API using the user credentials // The auth only needs to be called once per object, but before consuming endpoints // The auth method is chainable - $rock->auth()->get(...) // $rock->auth(); ### Working with data // Consume the API using Guzzle 6 style requests making it easy as pie! // However, we return a promise class that allows you to easily decode json // or work directly with the Guzzle response body, headers, etc. // Let's grab the campus list and then print the name to console. $campuses = $rock->auth()->get('Campuses')->json(); foreach ($campuses as $campus) { echo "Campus: {$campus->Name}\n"; // ... } // Need to check status codes and grab the response body? It's easy. $promise = $rock->get('Campuses'); var_dump( $promise->response()->getHeaders(), $promise->response()->getStatusCode(), (string)$promise->response()->getBody() ); // Let's search some data... $people = $rock->get('People/Search?name=Smith')->json(); var_dump($people); // Easily consume the Rock RMS REST API resources with the following actions - // $rock->get($uri, array $options = []) : Promise // $rock->head($uri, array $options = []) : Promise // $rock->put($uri, array $options = []) : Promise // $rock->post($uri, array $options = []) : Promise // $rock->patch($uri, array $options = []) : Promise // $rock->delete($uri, array $options = []) : Promise // $rock->getAsync($uri, array $options = []) : Promise // $rock->headAsync($uri, array $options = []) : Promise // $rock->putAsync($uri, array $options = []) : Promise // $rock->postAsync($uri, array $options = []) : Promise // $rock->patchAsync($uri, array $options = []) : Promise // $rock->deleteAsync($uri, array $options = []) : Promise // See Rock RMS demo for full list of REST API endpoints/resources. // More documentation coming soon...