The Yaf_Route_Interface class

(Yaf >=1.0.0)

Introduction

Yaf_Route_Interface defines the contract every route must implement: Yaf_Route_Interface::route(), which inspects the request and claims it by setting the module, controller and action (and optionally request parameters), and Yaf_Route_Interface::assemble(), which builds a URL from route info.

Implement this interface to define a custom route, and register it on the router with Yaf_Router::addRoute(). The built-in route classes (Yaf_Route_Static, Yaf_Route_Simple, Yaf_Route_Supervar, Yaf_Route_Rewrite, Yaf_Route_Regex and Yaf_Route_Map) all implement it.

Class synopsis

class Yaf_Route_Interface {
/* Methods */
abstract public function assemble(array $info, array $query = ?): string
abstract public function route(Yaf_Request_Abstract $request): bool
}

Table of Contents

add a note

User Contributed Notes

There are no user contributed notes for this page.