API / Minn\Rest / DeclaredPostsController

DeclaredPostsController final readonly class

Minn\Rest\DeclaredPostsController · public/minn/src/Minn/Rest/DeclaredPostsController.php · 56 lines

wp/v2/{rest_base} for extra post types declared by an active extension. Registered last so core collections (users, comments, menus, ...) match first; an unknown base is declined, so a plugin's own route under wp/v2 (answered by the runtime after the engine's routes) is not shadowed.

Used by 1

Constants and properties

privatereadonly Minn\Rest\Types $types

Promoted from the constructor.

privatereadonly Minn\Rest\PostsController $reads

Promoted from the constructor.

privatereadonly Minn\Rest\PostsWriteController $writes

Promoted from the constructor.

Public

new__construct(Minn\Rest\Types $types, Minn\Rest\PostsController $reads, Minn\Rest\PostsWriteController $writes)#
methodlist(Minn\Http\Request $request, string $base): Minn\Http\ResponseGET /wp/v2/{base:[a-z0-9_-]+} (declared type {base})#

A declared type's list.

methodsingle(Minn\Http\Request $request, string $base, string $id): Minn\Http\ResponseGET /wp/v2/{base:[a-z0-9_-]+}/{id:[\d]+} (declared type {base})#

A declared type's single post.

methodcreate(Minn\Http\Request $request, string $base): Minn\Http\ResponsePOST /wp/v2/{base:[a-z0-9_-]+} (declared type {base})#

Creates a post of a declared type.

methodupdate(Minn\Http\Request $request, string $base, string $id): Minn\Http\ResponsePOST /wp/v2/{base:[a-z0-9_-]+}/{id:[\d]+} (declared type {base})PUT /wp/v2/{base:[a-z0-9_-]+}/{id:[\d]+} (declared type {base})PATCH /wp/v2/{base:[a-z0-9_-]+}/{id:[\d]+} (declared type {base})#

Updates a post of a declared type.

methoddelete(Minn\Http\Request $request, string $base, string $id): Minn\Http\ResponseDELETE /wp/v2/{base:[a-z0-9_-]+}/{id:[\d]+} (declared type {base})#

Trashes or deletes a post of a declared type.

Internals 1

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privateslug(string $base): string#