Nextcloud PHP API (master)

ApiRoute extends Route
in package

This attribute can be used to define API routes on controller methods.

It works in addition to the traditional routes.php method and has the same parameters (except for the name parameter which is not needed).

Tags
since
29.0.0

Table of Contents

Constants

TYPE_API  = 'ocs'
Corresponds to the `ocs` key in routes.php
TYPE_FRONTPAGE  = 'routes'
Corresponds to the `routes` key in routes.php

Properties

$defaults  : array<string|int, mixed>|null
$postfix  : string|null
$requirements  : array<string|int, mixed>|null
$root  : string|null
$type  : string
$url  : string
$verb  : string

Methods

__construct()  : mixed
getDefaults()  : array<string|int, mixed>|null
getPostfix()  : string|null
getRequirements()  : array<string|int, mixed>|null
getRoot()  : string|null
getType()  : string
getUrl()  : string
getVerb()  : string
toArray()  : array{verb: string, url: string, requirements?: array, defaults?: array, root?: string, postfix?: string}

Constants

TYPE_API

Corresponds to the `ocs` key in routes.php

public mixed TYPE_API = 'ocs'
Tags
see
ApiRoute
since
29.0.0

TYPE_FRONTPAGE

Corresponds to the `routes` key in routes.php

public mixed TYPE_FRONTPAGE = 'routes'
Tags
see
FrontpageRoute
since
29.0.0

Properties

$defaults

protected array<string|int, mixed>|null $defaults = null

$postfix

protected string|null $postfix = null

$requirements

protected array<string|int, mixed>|null $requirements = null

$root

protected string|null $root = null

$type

protected string $type

Methods

__construct()

public __construct(string $verb, string $url[, array<string|int, mixed>|null $requirements = null ][, array<string|int, mixed>|null $defaults = null ][, string|null $root = null ][, string|null $postfix = null ]) : mixed
Parameters
$verb : string

HTTP method of the route.

$url : string

The path of the route.

$requirements : array<string|int, mixed>|null = null

Array of regexes mapped to the path parameters.

$defaults : array<string|int, mixed>|null = null

Array of default values mapped to the path parameters.

$root : string|null = null

Custom root. For OCS all apps are allowed, but for index.php only some can use it.

$postfix : string|null = null

Postfix for the route name.

Tags
inheritDoc
since
29.0.0

getDefaults()

public getDefaults() : array<string|int, mixed>|null
Tags
since
29.0.0
Return values
array<string|int, mixed>|null

getPostfix()

public getPostfix() : string|null
Tags
since
29.0.0
Return values
string|null

getRequirements()

public getRequirements() : array<string|int, mixed>|null
Tags
since
29.0.0
Return values
array<string|int, mixed>|null

getRoot()

public getRoot() : string|null
Tags
since
29.0.0
Return values
string|null

getType()

public getType() : string
Tags
since
29.0.0
Return values
string

getUrl()

public getUrl() : string
Tags
since
29.0.0
Return values
string

getVerb()

public getVerb() : string
Tags
since
29.0.0
Return values
string

toArray()

public toArray() : array{verb: string, url: string, requirements?: array, defaults?: array, root?: string, postfix?: string}
Tags
since
29.0.0
Return values
array{verb: string, url: string, requirements?: array, defaults?: array, root?: string, postfix?: string}

        
On this page

Search results