Inject: default parameter values

Handler signature: function ($id, $page = 1). The framework injects $id from the URL; $page isn't in the URL or the framework injection table, so the default value (1) is used. To override, use the path with two segments — see the related URL below.

Live URL

GET /demo/inject/defaults/9 · with page: /demo/inject/defaults/9/7

Response

Status
200 OK
Content-Type
application/json
{
    "id": "9",
    "page": 1,
    "note": "$page used default value 1 because no override was passed"
}