bramus / bramus/router

Pass custom parameters via Class@Method?

Open
#153 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
1.1k
Forks
236
PR merge metrics
No merged PRs in 30d

Description

Hi,

is it possible to pass custom parameters via [Class@Method](https://github.com/bramus/router#classmethod-calls)?
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);
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the repository documentation for Class@Method calls and the $router->get route-registration entry point. Trace how route parameters reach Handler@detail, then define the expected behavior for additional custom parameters; done means there is a clear, documented way to supply them and the behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.