diff --git a/README.md b/README.md index fdc1cc9..acc8573 100644 --- a/README.md +++ b/README.md @@ -27,22 +27,22 @@ A simple example to illustrate the general idea. This JSON representation from } } ``` -can be built with the following php code (less imports): +can be built with the following php code: ```php setLink('self', '/articles/1/relationships/author'); -$author->setLink('related','/articles/1/author'); +$author->setLink('related', '/articles/1/author'); +$articles = new ResourceObject('articles', '1'); $articles->setRelationship('author', $author); $articles->setAttribute('title', 'Rails is Omakase'); -$doc = \JsonApiPhp\JsonApi\Document::fromResource($articles); -echo json_encode($doc, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); +echo json_encode(Document::fromResource($articles), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); ``` Please refer to [the tests](./test) for the full API documentation: