router icon indicating copy to clipboard operation
router copied to clipboard

Pass custom parameters via Class@Method?

Open sephentos opened this issue 4 years ago • 1 comments

Hi,

is it possible to pass custom parameters via Class@Method? I am aware that something like this works:

class Handler {
    public static function detail($name) {
        echo 'Hello ' . htmlentities($name);
    }
}
$router->get('/hello/{name}', 'Handler@detail');

Any way to pass parameters which detail may require? e.g.

public static function detail($name, $customPar, $customPar2) {
...
$router->get('/hello/{name}', 'Handler@detail', $customPar, $customPar2);

sephentos avatar Jun 17 '21 12:06 sephentos

No, these parameters are only for dynamic routes. If you need to specify any variables or constants, please do that within your method or instance. If you can tell me, what you want to do specifically, I can maybe give you advice how to optimize your procedure

~ Tim ✌🏻

uvulpos avatar Jun 23 '21 15:06 uvulpos