From 932c4dbca6803e647c3a1ed6968d08b960cad725 Mon Sep 17 00:00:00 2001 From: John Charman Date: Thu, 15 Dec 2022 09:15:12 +0000 Subject: [PATCH] README: updated --- README.md | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ec4bc74..54af786 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,28 @@ To publish a copy to your own config, use the following: php artisan vendor:publish --tag="membrane" ``` -### Global Usage +### Usage + +#### Request Validation + +The `RequestValidation` middleware will validate or invalidate incoming requests and let you decide how to react. +You can precede it with your own custom middleware or precede it with one of the following built-in options: + +#### Nested Json Response + +The `ResponseJsonNested` MUST precede the `RequestValidation` middleware +as it relies on the container containing the result. +It will check whether the request has passed or failed validation. +Invalid requests will return a response detailing the reasons the request was invalid. -To validate requests for all your routes, add the `RequestValidation` middleware to `$middleware` property -of `app/Http/Kernel.php` class: +#### Flat Json Response + +The `ResponseJsonFlat` MUST precede the `RequestValidation` middleware +as it relies on the container containing the result. +It will check whether the request has passed or failed validation. +Invalid requests will return a response detailing the reasons the request was invalid. + +### Global Usage ```php protected $middleware = [ @@ -38,6 +56,3 @@ protected $middleware = [ // ... ]; ``` - -**Please note:** It is not required to be at the top of your middleware, -but it must precede anything that relies on receiving a valid request.