在yii2中创建extrapattern

URL : http://localhost/eg_integration/api/web/v1/devices/cacf090690d9dab14df06219ac36b3cd/registrations/pass.usa.gift?passesUpdatedSince=1232

host :http://localhost/eg_integration/api/web/v1 controller : devices contant term : registrations, passesUpdatedSince

Url rule code:

'class' => 'yiiest\UrlRule',
                                    'controller' => 'v1/devices',
                                    'pluralize' => false,
                                    'extraPatterns' => [ 
   'GET registration' => 'getserialnumber', 
]

hot to handle this url in extrapattern

Given that the url is constant, I would set a rule like this:

'GET cacf090690d9dab14df06219ac36b3cd/registrations/pass.usa.gift' => 'getserialnumber',

Then in your deviceController you get the query parameter:

public function actionGetserialnumber() {
    ...
    $value = Yii::$app->getRequest()->getQueryParam('passesUpdatedSince', $defaultValue)
    ...
}