RouteInterface
extends
ContainerInterface
in
PHP Mini Framework
Tags
Table of Contents
- addSingleton() : self
- Add singleton
- call() : self
- Set callable route destination
- delete() : RouteInterface
- Set HTTP DELETE routes
- get() : RouteInterface
- Set HTTP GET routes
- getCallable() : Closure|null
- getController() : string
- getFunction() : string
- getMethod() : string|null
- getMiddlewares() : array<string|int, MiddlewareInterface>
- getParams() : array<string|int, mixed>|null
- getPath() : string|null
- getSingleton() : self
- Get singleton
- head() : RouteInterface
- Set HTTP HEAD routes
- middleware() : self
- Add route middleware
- middlewares() : self
- Add route middlewares
- params() : self
- Add route params.
- patch() : RouteInterface
- Set HTTP PATCH routes
- post() : RouteInterface
- Set HTTP POST routes
- put() : RouteInterface
- Set HTTP PUT routes
- to() : self
- Set controller route destination
Methods
addSingleton()
Add singleton
public
addSingleton(string $className, object|null &$object) : self
Parameters
- $className : string
- $object : object|null
Tags
Return values
self —call()
Set callable route destination
public
call(Closure $callable) : self
Parameters
- $callable : Closure
-
Function to execute for route
Tags
Return values
self —delete()
Set HTTP DELETE routes
public
static delete(string $path) : RouteInterface
Parameters
- $path : string
-
HTTP path. e.g /home. See
Router::MATCHER_REGXfor list of parameters matching keywords
Tags
Return values
RouteInterface —get()
Set HTTP GET routes
public
static get(string $path) : RouteInterface
Parameters
- $path : string
-
HTTP path. e.g /home. See
Router::MATCHER_REGXfor list of parameters matching keywords
Tags
Return values
RouteInterface —getCallable()
public
getCallable() : Closure|null
Tags
Return values
Closure|null —getController()
public
getController() : string
Tags
Return values
string —getFunction()
public
getFunction() : string
Tags
Return values
string —getMethod()
public
getMethod() : string|null
Tags
Return values
string|null —getMiddlewares()
public
getMiddlewares() : array<string|int, MiddlewareInterface>
Tags
Return values
array<string|int, MiddlewareInterface> —getParams()
public
getParams() : array<string|int, mixed>|null
Tags
Return values
array<string|int, mixed>|null —getPath()
public
getPath() : string|null
Tags
Return values
string|null —getSingleton()
Get singleton
public
getSingleton(string $className[, object $default = null ]) : self
Parameters
- $className : string
- $default : object = null
Tags
Return values
self —head()
Set HTTP HEAD routes
public
static head(string $path) : RouteInterface
Parameters
- $path : string
-
HTTP path. e.g /home. See
Router::MATCHER_REGXfor list of parameters matching keywords
Tags
Return values
RouteInterface —middleware()
Add route middleware
public
middleware(MiddlewareInterface $middleware) : self
Parameters
- $middleware : MiddlewareInterface
Tags
Return values
self —middlewares()
Add route middlewares
public
middlewares([array<string|int, MiddlewareInterface> $middlewares = [] ]) : self
Parameters
- $middlewares : array<string|int, MiddlewareInterface> = []
-
Array of Middleware Interface.
Tags
Return values
self —params()
Add route params.
public
params(array<string|int, mixed> $params) : self
List of key => value params. Where:
-
key= function paramater name -
value= function paramater value
Parameters
- $params : array<string|int, mixed>
Tags
Return values
self —patch()
Set HTTP PATCH routes
public
static patch(string $path) : RouteInterface
Parameters
- $path : string
-
HTTP path. e.g /home. See
Router::MATCHER_REGXfor list of parameters matching keywords
Tags
Return values
RouteInterface —post()
Set HTTP POST routes
public
static post(string $path) : RouteInterface
Parameters
- $path : string
-
HTTP path. e.g /home. See
Router::MATCHER_REGXfor list of parameters matching keywords
Tags
Return values
RouteInterface —put()
Set HTTP PUT routes
public
static put(string $path) : RouteInterface
Parameters
- $path : string
-
HTTP path. e.g /home. See
Router::MATCHER_REGXfor list of parameters matching keywords
Tags
Return values
RouteInterface —to()
Set controller route destination
public
to(string $controller, string $function) : self
Parameters
- $controller : string
-
Application Controller class name e.g Home
- $function : string
-
Application Controller (public) function. e.g index