\Omega\Routing RouterInterface

Router interface.

The RouterInterface represents the contract for a router implementation.

Summary

Methods
Constants
get()
post()
put()
delete()
patch()
options()
any()
dispatch()
No public constants found

Methods

get()

get(string  $path, mixed  $handler, string|null  $name = null) : \Omega\Routing\Route

Get method.

Adds a GET route to the router.

Parameters

string $path

Holds the path pattern for the route.

mixed $handler

Holds the handler for the route.

string|null $name

Holds the route name or null.

Returns

\Omega\Routing\Route —

Returns the added Route instance.

post()

post(string  $path, mixed  $handler, string|null  $name = null) : \Omega\Routing\Route

Post method.

Adds a POST route to the router.

Parameters

string $path

Holds the path pattern for the route.

mixed $handler

Holds the handler for the route.

string|null $name

Holds the route name or null.

Returns

\Omega\Routing\Route —

Returns the added Route instance.

put()

put(string  $path, mixed  $handler, string|null  $name = null) : \Omega\Routing\Route

Put method.

Adds a PUT route to the router.

Parameters

string $path

Holds the path pattern for the route.

mixed $handler

Holds the handler for the route.

string|null $name

Holds the route name or null.

Returns

\Omega\Routing\Route —

Returns the added Route instance.

delete()

delete(string  $path, mixed  $handler, string|null  $name = null) : \Omega\Routing\Route

Delete method.

Adds a DELETE route to the router.

Parameters

string $path

Holds the path pattern for the route.

mixed $handler

Holds the handler for the route.

string|null $name

Holds the route name or null.

Returns

\Omega\Routing\Route —

Returns the added Route instance.

patch()

patch(string  $path, mixed  $handler, string|null  $name = null) : \Omega\Routing\Route

Patch method.

Adds a PATCH route to the router.

Parameters

string $path

Holds the path pattern for the route.

mixed $handler

Holds the handler for the route.

string|null $name

Holds the route name or null.

Returns

\Omega\Routing\Route —

Returns the added Route instance.

options()

options(string  $path, mixed  $handler, string|null  $name = null) : \Omega\Routing\Route

Options method.

Adds an OPTIONS route to the router.

Parameters

string $path

Holds the path pattern for the route.

mixed $handler

Holds the handler for the route.

string|null $name

Holds the route name or null.

Returns

\Omega\Routing\Route —

Returns the added Route instance.

any()

any(string  $path, mixed  $handler, string|null  $name = null) : \Omega\Routing\Route

Any method.

Adds a route that matches ANY HTTP method to the router.

Parameters

string $path

Holds the path pattern for the route.

mixed $handler

Holds the handler for the route.

string|null $name

Holds the route name or null.

Returns

\Omega\Routing\Route —

Returns the added Route instance.

dispatch()

dispatch() : mixed

Dispatches the router, matching the current request and executing the corresponding route handler.

Returns

mixed —

The result of the route handler.