final class ApiEndpointRegistry (View source)

Owns the canonical ordered API endpoint set and enforces unique names and method-path pairs.

Methods

add(string $method, string $path, ControllerAction $controllerAction, string $name, string $summary, string $description, ApiAccess $access = ApiAccess::Protected, ApiEndpointMetadata|null $metadata = null)

Normalizes, validates and registers one endpoint.

get(string $path, ControllerAction $controllerAction, string $name, string $summary, string $description, ApiAccess $access = ApiAccess::Protected, ApiEndpointMetadata|null $metadata = null)

Registers a GET endpoint with the supplied access and metadata policy.

post(string $path, ControllerAction $controllerAction, string $name, string $summary, string $description, ApiAccess $access = ApiAccess::Protected, ApiEndpointMetadata|null $metadata = null)

Registers a POST endpoint with the supplied access and metadata policy.

put(string $path, ControllerAction $controllerAction, string $name, string $summary, string $description, ApiAccess $access = ApiAccess::Protected, ApiEndpointMetadata|null $metadata = null)

Registers a PUT endpoint with the supplied access and metadata policy.

patch(string $path, ControllerAction $controllerAction, string $name, string $summary, string $description, ApiAccess $access = ApiAccess::Protected, ApiEndpointMetadata|null $metadata = null)

Registers a PATCH endpoint with the supplied access and metadata policy.

delete(string $path, ControllerAction $controllerAction, string $name, string $summary, string $description, ApiAccess $access = ApiAccess::Protected, ApiEndpointMetadata|null $metadata = null)

Registers a DELETE endpoint with the supplied access and metadata policy.

findByName(string $name)

Returns the endpoint registered under the exact name, or null when none exists.

findByRequest(string $method, string $path)

Performs an exact definition lookup, with HEAD falling back to a matching GET definition.

array
all()

Returns endpoints in their registration order.

array

Details

add

ApiEndpoint add(string $method, string $path, ControllerAction $controllerAction, string $name, string $summary, string $description, ApiAccess $access = ApiAccess::Protected, ApiEndpointMetadata|null $metadata = null)

Normalizes, validates and registers one endpoint.

Parameters

string $method
string $path
ControllerAction $controllerAction
string $name
string $summary
string $description
ApiAccess $access
ApiEndpointMetadata|null $metadata

Return Value

ApiEndpoint

Exceptions

InvalidArgumentException
LogicException

get

ApiEndpoint get(string $path, ControllerAction $controllerAction, string $name, string $summary, string $description, ApiAccess $access = ApiAccess::Protected, ApiEndpointMetadata|null $metadata = null)

Registers a GET endpoint with the supplied access and metadata policy.

Parameters

string $path
ControllerAction $controllerAction
string $name
string $summary
string $description
ApiAccess $access
ApiEndpointMetadata|null $metadata

Return Value

ApiEndpoint

Exceptions

InvalidArgumentException
LogicException

post

ApiEndpoint post(string $path, ControllerAction $controllerAction, string $name, string $summary, string $description, ApiAccess $access = ApiAccess::Protected, ApiEndpointMetadata|null $metadata = null)

Registers a POST endpoint with the supplied access and metadata policy.

Parameters

string $path
ControllerAction $controllerAction
string $name
string $summary
string $description
ApiAccess $access
ApiEndpointMetadata|null $metadata

Return Value

ApiEndpoint

Exceptions

InvalidArgumentException
LogicException

put

ApiEndpoint put(string $path, ControllerAction $controllerAction, string $name, string $summary, string $description, ApiAccess $access = ApiAccess::Protected, ApiEndpointMetadata|null $metadata = null)

Registers a PUT endpoint with the supplied access and metadata policy.

Parameters

string $path
ControllerAction $controllerAction
string $name
string $summary
string $description
ApiAccess $access
ApiEndpointMetadata|null $metadata

Return Value

ApiEndpoint

Exceptions

InvalidArgumentException
LogicException

patch

ApiEndpoint patch(string $path, ControllerAction $controllerAction, string $name, string $summary, string $description, ApiAccess $access = ApiAccess::Protected, ApiEndpointMetadata|null $metadata = null)

Registers a PATCH endpoint with the supplied access and metadata policy.

Parameters

string $path
ControllerAction $controllerAction
string $name
string $summary
string $description
ApiAccess $access
ApiEndpointMetadata|null $metadata

Return Value

ApiEndpoint

Exceptions

InvalidArgumentException
LogicException

delete

ApiEndpoint delete(string $path, ControllerAction $controllerAction, string $name, string $summary, string $description, ApiAccess $access = ApiAccess::Protected, ApiEndpointMetadata|null $metadata = null)

Registers a DELETE endpoint with the supplied access and metadata policy.

Parameters

string $path
ControllerAction $controllerAction
string $name
string $summary
string $description
ApiAccess $access
ApiEndpointMetadata|null $metadata

Return Value

ApiEndpoint

Exceptions

InvalidArgumentException
LogicException

findByName

ApiEndpoint|null findByName(string $name)

Returns the endpoint registered under the exact name, or null when none exists.

Parameters

string $name

Return Value

ApiEndpoint|null

findByRequest

ApiEndpoint|null findByRequest(string $method, string $path)

Performs an exact definition lookup, with HEAD falling back to a matching GET definition.

This operation does not implement Router matching and must not authorize an incoming request; request security uses ApiEndpointRequestResolver with the canonical RouteMatch instead.

Parameters

string $method
string $path

Return Value

ApiEndpoint|null

all

array all()

Returns endpoints in their registration order.

Return Value

array