'About us'`), and a kind of page with many of them (a service, * a project) with a resolver: `app(PageNames::class)->register(fn (string $path) => ...)` returns the name, or null for "not mine". */ final class PageNames { /** @var list */ private array $resolvers = []; /** @param Closure(string): ?string $resolver gets an address like `/over-ons` */ public function register(Closure $resolver): void { $this->resolvers[] = $resolver; } public function name(string $path): ?string { $names = (array) config('manager.statistics.names', []); $name = $names[$path] ?? $names['/'.trim($path, '/')] ?? null; if (is_string($name) && $name !== '') { return $name; } foreach ($this->resolvers as $resolver) { $name = $resolver($path); if (is_string($name) && $name !== '') { return $name; } } return null; } }