You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ```AuthorSchema``` provides information about resource's attributes and might look like
79
78
80
79
```php
81
-
class AuthorSchema extends SchemaProvider
80
+
class AuthorSchema extends BaseSchema
82
81
{
83
82
protected $resourceType = 'people';
84
83
85
-
public function getId($author)
84
+
public function getId($author): ?string
86
85
{
87
86
/** @var Author $author */
88
87
return $author->authorId;
89
88
}
90
89
91
-
public function getAttributes($author)
90
+
public function getAttributes($author, array $fieldKeysFilter = null): ?array
92
91
{
93
92
/** @var Author $author */
94
93
return [
@@ -103,8 +102,14 @@ The first ```EncoderOptions``` parameter ```JSON_PRETTY_PRINT``` is a PHP predef
103
102
104
103
The second ```EncoderOptions``` parameter ```http://example.com/api/v1``` is a URL prefix that will be applied to all encoded links unless they have ```$treatAsHref``` flag set to ```true```.
105
104
105
+
A sample program with encoding of multiple, nested, filtered objects and more is [here](sample).
106
+
106
107
**For more advanced usage please check out the [Wiki](https://github.com/neomerx/json-api/wiki)**.
107
108
109
+
## Versions
110
+
111
+
Current version is 2.x (PHP 7.1+) for older PHP versions (PHP 5.5 - 7.0, HHVM) please use version 1.x.
112
+
108
113
## Questions?
109
114
110
115
Do not hesitate to check [issues](https://github.com/neomerx/json-api/issues) or post a new one.
@@ -117,8 +122,6 @@ Are you planning to add JSON API and need help? We'd love to talk to you [sales@
117
122
118
123
If you have spotted any specification changes that are not reflected in this package please post an [issue](https://github.com/neomerx/json-api/issues). Pull requests for documentation and code improvements are welcome.
119
124
120
-
Current tasks are managed with [Waffle.io](https://waffle.io/neomerx/json-api).
121
-
122
125
There are 2 ways to send pull requests
123
126
- small pull requests should be sent to `develop` branch as **1 commit**
124
127
- for bigger pull requests (e.g. new features) it's recommended to create an `issue` requesting a new branch for that feature. When a new branch named `feature/issueXX` is created (where `XX` is the issue number) you should post pull requests to this branch. When the feature is completed the branch will be squashed and merged to `develop` and then to `master` branches.
0 commit comments