tobyzerner / json-api-php

JSON-API (http://jsonapi.org) responses in PHP.
MIT License
436 stars 79 forks source link

Code examples for GET resource, GET collection #137

Closed piotrbaczek closed 6 years ago

piotrbaczek commented 6 years ago

Hi, could you provide code examples on how to correctly use your library; Let's say i have

$user= new stdClass();
$user->type = 'user';
$user->id = 1;
$user->login='testuser123';
$user->firstname = 'John';
$user->surname = 'Doe';
$user->tokens = [];
$token = new stdClass();
$token->id = 1;
$token->type = 'user_token';
$token->value = '#4aF^c3(p*v$c[BE';
$user->tokens[] = $token;

How should the library be setup to correctly get user with relationship, by fields etc. ?

piotrbaczek commented 6 years ago

And same thing for collection of users, and error handling. Maybe worth to extend the README?

tobyzerner commented 6 years ago

The README more or less runs through all of the functionality of the library. Can you be more specific about the parts you're having trouble with?