PHP 클래스 PHPRouter\Router

파일 보기 프로젝트 열기: dannyvankooten/php-router 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( PHPRouter\RouteCollection $collection )
generate ( $routeName, array $params = [] ) : string Reverse route a named route
match ( string $requestUrl, string $requestMethod = 'GET' ) : boolean | Route Match given request _url and request method and see if a route has been defined for it If so, return route's target If called multiple times
matchCurrentRequest ( ) Matches the current request against mapped routes
parseConfig ( array $config ) : Router Create routes by array, and return a Router object
setBasePath ( $basePath ) Set the base _url - gets prepended to all route _url's.

메소드 상세

__construct() 공개 메소드

public __construct ( PHPRouter\RouteCollection $collection )
$collection PHPRouter\RouteCollection

generate() 공개 메소드

Reverse route a named route
public generate ( $routeName, array $params = [] ) : string
$routeName
$params array Optional array of parameters to use in URL
리턴 string The url to the route

match() 공개 메소드

Match given request _url and request method and see if a route has been defined for it If so, return route's target If called multiple times
public match ( string $requestUrl, string $requestMethod = 'GET' ) : boolean | Route
$requestUrl string
$requestMethod string
리턴 boolean | Route

matchCurrentRequest() 공개 메소드

Matches the current request against mapped routes
public matchCurrentRequest ( )

parseConfig() 공개 정적인 메소드

Create routes by array, and return a Router object
public static parseConfig ( array $config ) : Router
$config array provide by Config::loadFromFile()
리턴 Router

setBasePath() 공개 메소드

Set the base _url - gets prepended to all route _url's.
public setBasePath ( $basePath )
$basePath