PHP Mini Documentation

Route
in package
implements RouteInterface Uses Container

Application Routes Provider

PHP Mini Framework

Tags
copyright

busarm.com

license

https://github.com/Busarm/php-mini/blob/master/LICENSE (MIT License)

Interfaces, Classes, Traits and Enums

RouteInterface
PHP Mini Framework

Table of Contents

$callable  : Closure
$controller  : string
$function  : string
$method  : string
$middlewares  : array<string|int, MiddlewareInterface>
$params  : array<string|int, mixed>
$path  : string
$singletons  : array<string|int, mixed>
addSingleton()  : self
Add singleton
call()  : RouteInterface
Set callable route destination
cli()  : RouteInterface
Set CLI route
delete()  : RouteInterface
Set HTTP DELETE route
get()  : RouteInterface
Set HTTP GET route
getCallable()  : Closure|null
getController()  : string
getFunction()  : string
getMethod()  : string
getMiddlewares()  : array<string|int, MiddlewareInterface>
getParams()  : string
getPath()  : string
getSingleton()  : self
Get singleton
head()  : RouteInterface
Set HTTP HEAD route
middleware()  : RouteInterface
Add route middleware
middlewares()  : RouteInterface
Add route middlewares
params()  : self
Add route params.
patch()  : RouteInterface
Set HTTP PATCH route
post()  : RouteInterface
Set HTTP POST route
put()  : RouteInterface
Set HTTP PUT route
to()  : RouteInterface
Set controller route destination
__construct()  : mixed

Properties

$callable

protected Closure $callable = null

Request executable function

Tags

$controller

protected string $controller = null

Request controller

Tags

$function

protected string $function = null

Request controller function

Tags

$method

protected string $method = null

HTTP request method

Tags

$params

protected array<string|int, mixed> $params = []

Request controller function params

Tags

$path

protected string $path = null

HTTP request path

Tags

$singletons

private array<string|int, mixed> $singletons = []
Tags

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(string $callable) : RouteInterface
Parameters
$callable : string

Function to execute for route

Tags
Return values
RouteInterface

cli()

Set CLI route

public static cli(string $controller, string $function[, array<string|int, mixed> $params = [] ]) : RouteInterface
Parameters
$controller : string
$function : string
$params : array<string|int, mixed> = []
Tags
Return values
RouteInterface

delete()

Set HTTP DELETE route

public static delete(string $path) : RouteInterface
Parameters
$path : string

HTTP path. e.g /user. See Router::MATCHER_REGX for list of parameters matching keywords

Tags
Return values
RouteInterface

get()

Set HTTP GET route

public static get(string $path) : RouteInterface
Parameters
$path : string

HTTP path. e.g /user. See Router::MATCHER_REGX for 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
Tags
Return values
string

getParams()

public getParams() : string
Tags
Return values
string

getPath()

public getPath() : string
Tags
Return values
string

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 route

public static head(string $path) : RouteInterface
Parameters
$path : string

HTTP path. e.g /user. See Router::MATCHER_REGX for list of parameters matching keywords

Tags
Return values
RouteInterface

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>
Return values
self

patch()

Set HTTP PATCH route

public static patch(string $path) : RouteInterface
Parameters
$path : string

HTTP path. e.g /user. See Router::MATCHER_REGX for list of parameters matching keywords

Tags
Return values
RouteInterface

post()

Set HTTP POST route

public static post(string $path) : RouteInterface
Parameters
$path : string

HTTP path. e.g /user. See Router::MATCHER_REGX for list of parameters matching keywords

Tags
Return values
RouteInterface

put()

Set HTTP PUT route

public static put(string $path) : RouteInterface
Parameters
$path : string

HTTP path. e.g /user. See Router::MATCHER_REGX for list of parameters matching keywords

Tags
Return values
RouteInterface

to()

Set controller route destination

public to(string $controller, string $function) : RouteInterface
Parameters
$controller : string

Application Controller class name e.g Home

$function : string

Application Controller (public) function. e.g index

Tags
Return values
RouteInterface

__construct()

private __construct() : mixed
Tags
Return values
mixed

        

Search results