PHP 클래스 System\Router

파일 보기 프로젝트 열기: rwarasaurus/nano 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$actions array Actions to call before and after routes
$method str The current request method
$not_found array | closure Actions to call on not matched routes
$patterns array Array of regex patterns to subsitute in defined routes
$routes array The defined routes set by the app
$uri str The current URI

공개 메소드들

메소드 설명
__construct ( $method, $uri ) Create a new instance of the Router class and import app routes from a folder or a single routes.php file
create ( ) : object Create a new instance of the Router class for chaining
dispatch ( ) : object Match the request with a route and run it
match ( ) : object Try and match the request method and uri with defined routes
routes ( ) : array Gets array of request method routes

메소드 상세

__construct() 공개 메소드

Create a new instance of the Router class and import app routes from a folder or a single routes.php file
public __construct ( $method, $uri )

create() 공개 정적인 메소드

Create a new instance of the Router class for chaining
public static create ( ) : object
리턴 object

dispatch() 공개 메소드

Match the request with a route and run it
public dispatch ( ) : object
리턴 object Response instance

match() 공개 메소드

Try and match the request method and uri with defined routes
public match ( ) : object
리턴 object Return a instance of a Route

routes() 공개 메소드

Gets array of request method routes
public routes ( ) : array
리턴 array

프로퍼티 상세

$actions 공개적으로 정적으로 프로퍼티

Actions to call before and after routes
public static array $actions
리턴 array

$method 공개적으로 프로퍼티

The current request method
public str $method
리턴 str

$not_found 공개적으로 정적으로 프로퍼티

Actions to call on not matched routes
public static array|closure $not_found
리턴 array | closure

$patterns 공개적으로 정적으로 프로퍼티

Array of regex patterns to subsitute in defined routes
public static array $patterns
리턴 array

$routes 공개적으로 정적으로 프로퍼티

The defined routes set by the app
public static array $routes
리턴 array

$uri 공개적으로 프로퍼티

The current URI
public str $uri
리턴 str