Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kyobul's avatar

Store request() in a variable

This is probably not the cleverest question but :

Inside a class, is there any benefit to store request() in a variable (as $this->request = request()) or using it as it is good enough ?

0 likes
5 replies
kyobul's avatar

Yes what, please ?

Yes - it is not of use at all or Yes - it could be usefull because of performance or ...

Snapey's avatar
Snapey
Best Answer
Level 122

No benefit at all, and not forgetting that in controllers you can just accept the $request anyway.

Please or to participate in this conversation.