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

cooperino's avatar

How to get request parameters when using request() helper?

if I do dd(request()); I get:

Illuminate\Http\Request {#43 ▼
  #json: null
  #convertedFiles: []
  #userResolver: Closure($guard = null) {#811 ▶}
  #routeResolver: Closure() {#821 ▶}
  +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45 ▶}
  +request: Symfony\Component\HttpFoundation\InputBag {#44 ▼
    #parameters: array:8 [▼

And the #parameters is the array of the registration form. how can I save these parameters to variables, or to an array?

Assuming I assigned request() to a variable:

$request = request();

0 likes
3 replies
Sinnbeck's avatar
$params = request()->all();
//or specific
$name = request()->input('name');

Or just read the docs for more examples

1 like
jlrdw's avatar

Why would you need to $request = request();

All of these parameters are already in a post array available to use.

1 like

Please or to participate in this conversation.