ApiRouter

Extends \Joomla\Router\Router

Joomla! API Router class

since

4.0.0

package

Application

Methods

__construct

Constructor.

__construct(\Joomla\CMS\Application\CMSApplicationInterface app, array maps = []) : mixed
since

1.0

Arguments

app

\Joomla\CMS\Application\CMSApplicationInterfaceThe application object

maps

arrayAn optional array of route maps

Response

mixed

createCRUDRoutes

Creates routes map for CRUD

createCRUDRoutes(string baseName, string controller, array defaults = [], bool publicGets = false) : void
since

4.0.0

Arguments

baseName

stringThe base name of the component.

controller

stringThe name of the controller that contains CRUD functions.

defaults

arrayAn array of default values that are used when the URL is matched.

publicGets

boolAllow the public to make GET requests.

getMatchingRoutes

Extract routes matching current route from all known routes.

getMatchingRoutes() : \Joomla\Router\Route[]
since

4.0.0

Response

\Joomla\Router\Route[]

getRoutePath

Get the path from the route and remove and leading or trailing slash.

getRoutePath() : string
since

4.0.0

Response

string

parseApiRoute

Parse the given route and return the name of a controller mapped to the given route.

parseApiRoute(string method = 'GET') : array
since

4.0.0

throws

\InvalidArgumentException

Arguments

method

stringRequest method to match. One of GET, POST, PUT, DELETE, HEAD, OPTIONS, TRACE or PATCH

Response

arrayAn array containing the controller and the matched variables.

removeIndexPhpFromPath

Removes the index.php from the route's path.

removeIndexPhpFromPath(string path) : string
since

4.0.0

Arguments

path

stringThe path

Response

string

Properties

app

The application object

since

4.0.0

Type(s)

CMSApplicationInterface