Skip to content

Commit 2389b59

Browse files
committed
Update
1 parent f51ca75 commit 2389b59

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ $ composer require neomerx/json-api ~0.3
5454

5555
### Basic usage
5656

57+
Assuming you've got an ```$author``` of type ```\Author``` you can encode it to JSON API as simple as this
58+
5759
```php
5860
$encoder = Encoder::instance([
59-
Author::class => AuthorSchema::class,
61+
'\Author' => '\AuthorSchema',
6062
], new JsonEncodeOptions(JSON_PRETTY_PRINT));
6163

6264
echo $encoder->encode($author) . PHP_EOL;
@@ -108,6 +110,7 @@ class AuthorSchema extends SchemaProvider
108110
### Object hierarchy with included objects
109111

110112
```php
113+
// '::class' constant (PHP 5.5 and above) convenient for classes in namespaces
111114
$encoder = Encoder::instance([
112115
Author::class => AuthorSchema::class,
113116
Comment::class => CommentSchema::class,

0 commit comments

Comments
 (0)