Site

Description

Routing and error handling.

Protected Properties

bool $dev = false
 
Request $request
 
Response $response
 
Session $session
 

Public Methods

 __construct ()
 Initializes the system for routing, error handling, and output. More...
 
void delete (string $path, $controller, array $extra=[])
 Routes DELETE More...
 
void get (string $path, $controller, array $extra=[])
 Routes GET and HEAD More...
 
Request getRequest ()
 
Response getResponse ()
 
Session getSession ()
 
bool isDev ()
 
$this log ($code, string $message)
 
void post (string $path, $controller, array $extra=[])
 Routes POST More...
 
void put (string $path, $controller, array $extra=[])
 Routes PUT More...
 
void route (array $methods, string $path, $controller, array $extra)
 Invokes a controller if the HTTP method and path match, and exits. More...
 
$this setDev (bool $dev)
 

Protected Methods

void route_call_exit (array $path, $controller, array $extra)
 

Constructor

◆ __construct()

__construct ( )

Initializes the system for routing, error handling, and output.

Methods

◆ delete()

void delete ( string  $path,
  $controller,
array  $extra = [] 
)

Routes DELETE

Parameters
string$path
string | callable$controller
array$extra

◆ get()

void get ( string  $path,
  $controller,
array  $extra = [] 
)

Routes GET and HEAD

Parameters
string$path
string | callable$controller
array$extra

◆ getRequest()

Request getRequest ( )
final
Returns
Request

◆ getResponse()

Response getResponse ( )
Returns
Response

◆ getSession()

Session getSession ( )
final
Returns
Session

◆ isDev()

bool isDev ( )
final
Returns
bool

◆ log()

$this log (   $code,
string  $message 
)
Parameters
mixed$code
string$message
Returns
$this

◆ post()

void post ( string  $path,
  $controller,
array  $extra = [] 
)

Routes POST

Parameters
string$path
string | callable$controller
array$extra

◆ put()

void put ( string  $path,
  $controller,
array  $extra = [] 
)

Routes PUT

Parameters
string$path
string | callable$controller
array$extra

◆ route()

void route ( array  $methods,
string  $path,
  $controller,
array  $extra 
)

Invokes a controller if the HTTP method and path match, and exits.

Absolute paths must start with /, all other paths are treated as regular expressions.

Parameters
string[]$methods
string$path
string | callable$controllerController class, or callable.
array$extra

◆ route_call_exit()

void route_call_exit ( array  $path,
  $controller,
array  $extra 
)
protected
Parameters
string[]$path
string | callable$controller
array$extra
See also
Controller::delete()
Controller::get()
Controller::post()
Controller::put()
Controller::__call()

◆ setDev()

$this setDev ( bool  $dev)
Parameters
bool$dev
Returns
$this