PATCH

Use the Slim application’s patch() method to map a callback function to a resource URI that is requested withthe HTTP PATCH method.

  1. <?php
  2. $app = new \Slim\Slim();
  3. $app->patch('/books/:id', function ($id) {
  4. // Patch book with given ID
  5. });

In this example, an HTTP PATCH request for “/books/1” will invoke the associated callback function, passing “1” asthe callback function’s argument.

The first argument of the Slim application’s patch() method is the resource URI. The last argument is anything thatreturns true for is_callable(). Typically, the last argument will be an anonymous function.