survos / platform-api-php
Survos PHP API 客户端
v1.2.2
2018-01-10 19:47 UTC
Requires
- guzzlehttp/guzzle: ~6.0
This package is auto-updated.
Last update: 2024-09-16 06:38:03 UTC
README
认证
require __DIR__ . '/../vendor/autoload.php'; use Survos\Client\SurvosClient; $client = new SurvosClient('https://demo.survos.com/api1.0/'); if (!$client->authorize('otest', 'tt')) { throw new \Exception('Wrong credentials!'); }
注册用户
use Survos\Client\Resource\UserResource; $data = [ 'username' => 'john85210101', 'email' => 'john85210101@gmail.com', 'name' => 'Nick', ]; $resource = new UserResource($client);; if ($resource->register($data)) { //user has been created }
获取项目
$item = $resource->getById($id);
获取分页项目
$page = 1; $maxPerPage = 10; $criteria = ['id' => $id]; $orderBy = ['id' => 'asc']; $response = $resource->getList($criteria, $orderBy, $page, $maxPerPage);
删除项目
$result = $resource->deleteById($id);