survos / platform-api-php
Survos php api client
Fund package maintenance!
kbond
v1.2.2
2018-01-10 19:47 UTC
Requires
- guzzlehttp/guzzle: ~6.0
This package is auto-updated.
Last update: 2024-11-16 06:58:31 UTC
README
Authenticating
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!'); }
Register user
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 }
Get item
$item = $resource->getById($id);
Get paginated items
$page = 1; $maxPerPage = 10; $criteria = ['id' => $id]; $orderBy = ['id' => 'asc']; $response = $resource->getList($criteria, $orderBy, $page, $maxPerPage);
Delete item
$result = $resource->deleteById($id);