Property | Type | Description | |
---|---|---|---|
$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 |
Method | Description | |
---|---|---|
__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 |
public __construct ( $method, $uri ) |
public static array $actions | ||
return | array |
public static array|closure $not_found | ||
return | array | closure |
public static array $patterns | ||
return | array |
public static array $routes | ||
return | array |