Get request with different params

hi, i have a micro api and a get url: .../files/list to list all files. Now i want to add search creterias to that url like version and date. something like: files/list/version or files/list/date or /files/list/versionAndDate. (it should be variable so the client can only search for date or version or both)

Have i do declare each of this urls in the route and call different actions in the controller or can i define some thing like that: files/list/{version}/{date} and it is varibale if there are a version or a date? how does it work in the best way?

thanks in advance

you can use wildcard in your route definitions or use :params at the end of it docs

In your case something like this shoud be work

use Phalcon\Mvc\Router;

$router = new Router();
$router->add(
    '/files/list/:params',
    [
        'controller' => 'files',
        'action'     => 'list',
        'params'     => 3,
    ]
);

// then in you action you can use

var_dump($this->dispatcher->getParams()); // all params
var_dump($this->dispatcher->getParam('name')); // named param

Good luck