Nextcloud PHP API (master)

Route
in package

This attribute can be used to define 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
Attributes
#[Attribute]
\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE

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

$verb

protected string $verb

Methods

__construct()

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

Either Route::TYPE_API or Route::TYPE_FRONTPAGE.

$verb : string

HTTP method of the route.

$url : string

The path of the route.

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

Array of regexes mapped to the path parameters.

$defaults : array<string, 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
psalm-param

Route::TYPE_* $type

psalm-param

'GET'|'HEAD'|'POST'|'PUT'|'DELETE'|'OPTIONS'|'PATCH' $verb

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