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

RabbitSC2's avatar

[SOLVED]Get url params into controller

Hi guys, not sure how this will/would work, but is it possible to load data params from a URL into a controller?

Im working with gocardless API and i need to get a url param into my controller, since its dynamic, this is what i have from the API documentation in my controller :

$redirectFlow = $client->redirectFlows()->complete(
        "SOME-REFERENCE-HERE", //The redirect flow ID from above.
        ["params" => ["session_token" => "dummy_session_token"]]
      );

The URL is returned with :

?redirect_flow_id=SOME-REFERENCE-HERE

So i need to take it from the URL and pop it into my controller, or have i misunderstood this?

Many thanks in advance!

0 likes
4 replies
tykus's avatar
tykus
Best Answer
Level 104

Any POST or GET params are available through the Request object:

request('redirect_flow_id')
1 like
Tray2's avatar

If by url prameters you mean ?param1=something&param2=someotherthing

Then you can access it in the Request object that you have in you controller method.

public function show(Request $request)
{
   $value = $request->query('param1');
}

If it's in the request header you do the same but instead of ->query() you use.

$value = $request->param1;

https://laravel.com/docs/5.7/requests

rassem's avatar

@rabbitsc2 i'm also trying to implement gocardless into my website. But not getting idea about it. Can you help me?

Please or to participate in this conversation.