summaryrefslogtreecommitdiff
path: root/src/Router.php
diff options
context:
space:
mode:
authorSam Light <sam@lightscale.co.uk>2026-06-10 19:00:32 +0100
committerSam Light <sam@lightscale.co.uk>2026-06-10 19:00:32 +0100
commit18669556d3f5e20bd92fd7731c774038d8b50e7e (patch)
tree14adc0b946a31839a42a19a544c65c6b215c907f /src/Router.php
parente4bb526bfda6aef396b551fb14a09ab9b2cfae53 (diff)
generate named route
Diffstat (limited to 'src/Router.php')
-rw-r--r--src/Router.php8
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);
+ }
}