How to get 3 parameters from the url with slim 4

Hello, I am starting with slim 4, creating an api for my personal project, but I need help, I want to send 3 parameters through the url in this way users/?parameter1=value1&parameter2=value2&parameter3=value3
Please help, how do I receive them in the routes file with slim 4
how to get 3 parameters from the url path: /users/?name=jose&login=jlr&passw=12345678 with slim 4

In Slim 4, you can obtain the entire URI and query params using the request object.

$this->request->getQueryParams() and you’ll get back an array of name/value pairs.

Thanks friend, do you have an example that I can see?

In any Action derived class, you should have an “action()” method where you can write

$args = $this->request->getQueryParams();

and this is an array of name/value pairs from your query params.

Thank you very much Rob Mitchel, I am going to try everything you tell me, thank you for your help and attention. Then I’ll comment and publish it on Slim’s post.

Hello everyone, thanks to Robm99x for his help, I was able to understand the use of getQueryParams(), I was able to send the parameters through the url, the way I wanted to do it, here I give you my example
url: http://api_slim_base.jl/users/1/test?parametro1=valor1&parametro2=valor2

function in path file: $group->get(‘/test’, function ($req, $res, array $args) {
// $params is an array of all the optional segments
$params = $req->getQueryParams();

     $res->getBody()->write("param1: ".$params['parameter1'].", param2: ".$params['parameter2']);
     return $res;
  })->setName('test');

With this I consider the issue closed and resolved.

Hello, I also wanted to highlight the other way to receive multiple parameters through the url with slim 4, as the documentation says:
url example:
http://api_slim_base.jl/users/1/news/Jose/jlr/12345678

function example

$group->get(‘/news[/{params:.*}]’, function ($request, $response, array $args) {
// $params is an array of all the optional segments
$params = explode(‘/’, $args[‘params’]);
//…
$response->getBody()->write("Name: “.$params[0].”, login: “.$params[1].”, password: ".$params[2]);
return $response;
})->setName(‘news’);

Which way is the best?
Is there any advantage to using one or the other?