router->getRoutes(); foreach ($routes as $route) { if (strpos($route->getPattern(), '/api') !== false) { $definitions[] = [ 'pattern' => $route->getPattern(), 'methods' => $route->getHttpMethods(), ]; } } return $this->jsonSuccess(['routes' => $definitions]); } }