Skip to content

Add put() and delete() shorthand methods to the Router #249

Description

@armanist

Currently, the Quantum PHP framework supports the following route definitions:

  • get($uri, $controller, $action)
  • post($uri, $controller, $action)
  • add($uri, $method, $controller, $action) – generic for any HTTP method

To improve developer ergonomics and consistency, we want to introduce shorthand methods for PUT and DELETE HTTP methods, just like we have for GET and POST.

Objective
Add two new shorthand methods to the router:

  • put($uri, $controller, $action)
  • delete($uri, $controller, $action)

These methods should internally call the add() method using 'PUT' and 'DELETE' respectively.

Example Usage

$route->put('[:alpha:2]?/my-posts/update/[id=:any]', 'PostController', 'update');
$route->delete('[:alpha:2]?/my-posts/delete-image/[id=:any]', 'PostController', 'deleteImage');

Metadata

Metadata

Assignees

Fields

No fields configured for Feature.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions