Skip to content

Add a patch() route helper to RouteBuilder #653

Open

Description

@armanist

Problem

Quantum\Router\RouteBuilder has route helpers for get(), post(), put() and delete(), but none for patch(). PATCH is a supported method everywhere else: Request::METHODS, HttpClient::METHODS, Csrf::METHODS, and the request body parsing treats it like PUT and POST. A PATCH route can only be written with add($path, 'PATCH', $handler).

Proposal

Add RouteBuilder::patch(string $path, $handler, string $action = null): self in src/Router/RouteBuilder.php, next to put(), written the same way:

return $this->addRoute(['PATCH'], $path, $handler, $action);

It only adds a method, so nothing existing changes. Routes declared with add($path, 'PATCH', ...) keep working.

Acceptance

  • patch() registers a route with the PATCH method, with a handler and with a controller action, the same as the other helpers.
  • A unit test in tests/Unit/Router/ next to the tests of put() and delete().
  • CHANGELOG.md entry under Added.
  • Docs: the routing page lists patch() with the other verb helpers (separate docs ticket).

Activity

  1. added this to the 3.1.2 milestone on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestroutingRouting and route resolution

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions