php - Binding data to request object in middleware [Slim Framework 3] -
i decoding jwt tokens in middleware following this example in documentation of slim framework. want bind userid
decoded jwt token request object. how in expressjs can't figure out how in slim framework. there anyway bind data request object?
i tried:
$request->setparam('userid', $userid);
ok, have solved problem. how can bind data request object in slim framework.
$request = $request->withattribute('userid', $userid);
and in route or controller, how can data:
$userid = $request->getattribute('userid');
Comments
Post a Comment