ApiRouter

Extends Router

Joomla! API Router class

since

4.0.0

package

Joomla CMS

Methods

__construct

Constructor.

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

1.0

Arguments

app

CMSApplicationInterfaceThe application object

maps

array<string|int, mixed>An optional array of route maps

Response

mixed

createCRUDRoutes

Creates routes map for CRUD

createCRUDRoutes( baseName,  controller, mixed||string|int defaults = [],  publicGets = false) : 
since

4.0.0

Arguments

baseName

stringThe base name of the component.

controller

stringThe name of the controller that contains CRUD functions.

defaults

array<string|int, mixed>An array of default values that are used when the URL is matched.

publicGets

boolAllow the public to make GET requests.

Response

void

getMatchingRoutes

Extract routes matching current route from all known routes.

getMatchingRoutes() : \Joomla\Router\Route||string|int
since

4.0.0

Response

array<string|int, Route>

getRoutePath

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

getRoutePath() : 
since

4.0.0

Response

string

parseApiRoute

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

parseApiRoute( method = 'GET') : mixed||string|int
since

4.0.0

throws

InvalidArgumentException

Arguments

method

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

Response

array<string|int, mixed>An array containing the controller and the matched variables.

removeIndexPhpFromPath

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

removeIndexPhpFromPath( path) : 
since

4.0.0

Arguments

path

stringThe path

Response

string

Properties

app

The application object

since

4.0.0

Type(s)

CMSApplicationInterface