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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -