diff options
| author | Sam Light <sam@lightscale.co.uk> | 2026-06-10 19:00:32 +0100 |
|---|---|---|
| committer | Sam Light <sam@lightscale.co.uk> | 2026-06-10 19:00:32 +0100 |
| commit | 18669556d3f5e20bd92fd7731c774038d8b50e7e (patch) | |
| tree | 14adc0b946a31839a42a19a544c65c6b215c907f /src | |
| parent | e4bb526bfda6aef396b551fb14a09ab9b2cfae53 (diff) | |
generate named route
Diffstat (limited to 'src')
| -rw-r--r-- | src/Router.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Router.php b/src/Router.php index 34d2695..4463150 100644 --- a/src/Router.php +++ b/src/Router.php @@ -174,4 +174,12 @@ class Router { return $this->namedRoutes[$name] ?? null; } + + /** @param array<string, mixed> $params */ + public function route(string $name, array $params = []): ?string + { + $route = $this->getNamedRoute($name); + $params = $this->strategy->parseParameters($params); + return $route?->getPath($params); + } } |
