Skip to content

Commit 842c35c

Browse files
authored
README to reflect the API (#37)
1 parent 8913d1c commit 842c35c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,18 @@ A simple example to illustrate the general idea. This (slightly modified) JSON r
3131
```
3232
can be built with the following php code:
3333
```php
34+
$articles = new ResourceObject('articles', '1');
3435
$author = Relationship::fromLinkage(
35-
Linkage::fromSingleResourceId(
36-
new ResourceId('people', '9')
36+
Linkage::fromSingleIdentifier(
37+
new ResourceIdentifier('people', '9')
3738
)
3839
);
3940
$author->setLink('self', '/articles/1/relationships/author');
4041
$author->setLink('related', '/articles/1/author');
41-
42-
$articles = new ResourceObject('articles', '1');
4342
$articles->setRelationship('author', $author);
4443
$articles->setAttribute('title', 'Rails is Omakase');
45-
46-
echo json_encode(Document::fromData($articles), JSON_PRETTY_PRINT);
44+
$doc = Document::fromResource($articles);
45+
echo json_encode($doc, JSON_PRETTY_PRINT);
4746
```
4847

4948
Please refer to [the tests](./test) for the full API documentation:

0 commit comments

Comments
 (0)