Routes
in package
implements
RoutesInterface
Routes storage
Table of Contents
Interfaces
- RoutesInterface
- Routes interface
Properties
- $adapter : RoutesStorageInterface
- Routes storage adapter
- $cache : CacheInterface
- Cache
Methods
- __construct() : mixed
- Constructor
- addApiRoute() : bool
- Add api route
- addHomePageRoute() : bool
- Add home page route
- addMiddleware() : bool
- Add route middleware
- addPageRoute() : bool
- Add page route
- delete() : bool
- Delete route
- deleteHomePage() : bool
- Delete home page route
- deleteRoutes() : bool
- Delete routes
- getAllRoutes() : array<string|int, mixed>
- Get all actve routes from storage
- getHomePageRoute() : array<string|int, mixed>
- Get home page route
- getLanguagePattern() : string
- Get language pattern
- getRoute() : array<string|int, mixed>|false
- Get route
- getRouteDetails() : array<string|int, mixed>|null
- Get route details
- getRoutes() : array<string|int, mixed>
- Get routes
- has() : bool
- Return true if reoute exists
- saveRouteOptions() : bool
- Save route options
- saveTemplateRoute() : bool
- Add template route
- searchRoutes() : array<string|int, mixed>
- Get routes list for request method
- setRedirectUrl() : bool
- Save route redirect url
- setRoutesStatus() : bool
- Set routes status
Properties
$adapter
Routes storage adapter
protected
RoutesStorageInterface
$adapter
$cache
Cache
protected
CacheInterface
$cache
Methods
__construct()
Constructor
public
__construct(RoutesStorageInterface $adapter, CacheInterface $cache) : mixed
Parameters
- $adapter : RoutesStorageInterface
- $cache : CacheInterface
addApiRoute()
Add api route
public
addApiRoute(string $method, string $pattern, string $handlerClass, string|null $handlerMethod, string|null $extension[, int|null $auth = null ][, int $type = RoutesInterface::API ]) : bool
Parameters
- $method : string
- $pattern : string
- $handlerClass : string
- $handlerMethod : string|null
- $extension : string|null
- $auth : int|null = null
- $type : int = RoutesInterface::API
Tags
Return values
booladdHomePageRoute()
Add home page route
public
addHomePageRoute(string $pattern, string $handlerClass, string $handlerMethod, string|null $extension, string $pageName[, int $auth = null ][, string|null $name = null ][, bool $withLanguage = true ]) : bool
Parameters
- $pattern : string
- $handlerClass : string
- $handlerMethod : string
- $extension : string|null
- $pageName : string
- $auth : int = null
- $name : string|null = null
- $withLanguage : bool = true
Return values
booladdMiddleware()
Add route middleware
public
addMiddleware(string $method, string $pattern, string $middlewareClass) : bool
Parameters
- $method : string
- $pattern : string
- $middlewareClass : string
Return values
booladdPageRoute()
Add page route
public
addPageRoute(string $pattern, string $handlerClass, string $handlerMethod, string $extension, string|null $pageName[, int $auth = null ][, string|null $name = null ][, bool $withLanguage = true ][, int $type = RoutesInterface::PAGE ]) : bool
Parameters
- $pattern : string
- $handlerClass : string
- $handlerMethod : string
- $extension : string
- $pageName : string|null
- $auth : int = null
- $name : string|null = null
- $withLanguage : bool = true
- $type : int = RoutesInterface::PAGE
Return values
booldelete()
Delete route
public
delete(string $method, string $pattern) : bool
Parameters
- $method : string
- $pattern : string
Return values
booldeleteHomePage()
Delete home page route
public
deleteHomePage() : bool
Return values
booldeleteRoutes()
Delete routes
public
deleteRoutes([mixed $filter = [] ]) : bool
Parameters
- $filter : mixed = []
Return values
boolgetAllRoutes()
Get all actve routes from storage
public
getAllRoutes() : array<string|int, mixed>
Return values
array<string|int, mixed>getHomePageRoute()
Get home page route
public
getHomePageRoute() : array<string|int, mixed>
Return values
array<string|int, mixed>getLanguagePattern()
Get language pattern
public
getLanguagePattern(string $pattern) : string
Parameters
- $pattern : string
Return values
stringgetRoute()
Get route
public
getRoute(string $method, string $pattern) : array<string|int, mixed>|false
Parameters
- $method : string
- $pattern : string
Return values
array<string|int, mixed>|falsegetRouteDetails()
Get route details
public
getRouteDetails(string|int $id) : array<string|int, mixed>|null
Parameters
- $id : string|int
-
Route id or uuid
Return values
array<string|int, mixed>|nullgetRoutes()
Get routes
public
getRoutes([array<string|int, mixed> $filter = [] ]) : array<string|int, mixed>
Parameters
- $filter : array<string|int, mixed> = []
Return values
array<string|int, mixed>has()
Return true if reoute exists
public
has(string $method, string $pattern) : bool
Parameters
- $method : string
- $pattern : string
Return values
boolsaveRouteOptions()
Save route options
public
saveRouteOptions(string $method, string $pattern, array<string|int, mixed> $options) : bool
Parameters
- $method : string
- $pattern : string
- $options : array<string|int, mixed>
Return values
boolsaveTemplateRoute()
Add template route
public
saveTemplateRoute(string $pattern, string $handlerClass, string|null $handlerMethod, string $templateName, string|null $pageName[, int|null $auth = null ][, bool $replace = false ][, string|null $redirectUrl = null ][, int $type = RoutesInterface::PAGE ][, bool $withLanguage = true ]) : bool
Parameters
- $pattern : string
- $handlerClass : string
- $handlerMethod : string|null
- $templateName : string
- $pageName : string|null
- $auth : int|null = null
- $replace : bool = false
- $redirectUrl : string|null = null
- $type : int = RoutesInterface::PAGE
- $withLanguage : bool = true
Return values
boolsearchRoutes()
Get routes list for request method
public
searchRoutes(string $method[, int|null $type = null ]) : array<string|int, mixed>
Parameters
- $method : string
- $type : int|null = null
Return values
array<string|int, mixed>setRedirectUrl()
Save route redirect url
public
setRedirectUrl(string $method, string $pattern, string $url) : bool
Parameters
- $method : string
- $pattern : string
- $url : string
Return values
boolsetRoutesStatus()
Set routes status
public
setRoutesStatus(array<string|int, mixed> $filter, int $status) : bool
Parameters
- $filter : array<string|int, mixed>
- $status : int