Skip to content

Commit 46e3943

Browse files
committed
Add Pagination class & improve page params handling
1 parent 5008b0c commit 46e3943

File tree

6 files changed

+398
-274
lines changed

6 files changed

+398
-274
lines changed

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ As the result:
168168
}
169169
}
170170
```
171+
Pagination
172+
---------------------------
173+
The `page` query parameter family is reserved for pagination.
174+
This library implements a page-based strategy and allows the usage of query parameters such as `page[number]` and `page[size]`
175+
Example: `http://yourdomain.com/users?page[number]=3&page[size]=10`
176+
171177
Enabling JSON API Input
172178
---------------------------
173179
To let the API accept input data in JSON API format, configure the [[yii\web\Request::$parsers|parsers]] property of the request application component to use the [[tuyakhov\jsonapi\JsonApiParser]] for JSON input
@@ -313,15 +319,8 @@ return [
313319
'urlManager' => [
314320
'rules' => [
315321
[
316-
'class' => 'yii\rest\UrlRule',
317-
'controller' => 'user',
318-
'extraPatterns' => [
319-
'GET {id}/<name:\w+>' => 'view-related',
320-
'PATCH {id}/relationships/<name:\w+>' => 'update-relationship',
321-
'DELETE {id}/relationships/<name:\w+>' => 'delete-relationship',
322-
'{id}/<name:\w+>' => 'options'
323-
],
324-
'except' => ['index'],
322+
'class' => 'tuyakhov\jsonapi\UrlRule',
323+
'controller' => ['user'],
325324
],
326325

327326
]

0 commit comments

Comments
 (0)