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.
Constants and properties
| private | readonly Minn\Rest\Types $types | Promoted from the constructor. |
| private | readonly Minn\Rest\PostsController $reads | Promoted from the constructor. |
| private | readonly Minn\Rest\PostsWriteController $writes | Promoted from the constructor. |
Public
| new | __construct(Minn\Rest\Types $types, Minn\Rest\PostsController $reads, Minn\Rest\PostsWriteController $writes)# | |
| method | list(Minn\Http\Request $request, string $base): Minn\Http\ResponseGET /wp/v2/{base:[a-z0-9_-]+} (declared type {base})# | A declared type's list. |
| method | single(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. |
| method | create(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. |
| method | update(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. |
| method | delete(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.
| private | slug(string $base): string# |
Nothing matches.