I used slim 3 framework with davidepastore/slim-validation
to validate my data.
davidepastore/slim-validation
itself uses Respect validation
rules.
I used validation in middleware (in router file):
use DavidePastore\Slim\Validation\Validation;
use app\Controllers\RegisterController;
.
.
.
$app->post("register" ,[RegisterController::class , "register"])->add(new Validation(RegisterController::RegisterValidate(),$translator));
RegisterController::RegisterValidate() return some rules like :
[
"password" => v::length(6, 18) ,
"password_confirmation" => v::key('password_confirmation', v::equals(v::key('password'))),
]
But it did not work. Always return error. Error message is "Key {{name}} must be present".
I used the v::keyValue('password_confirmation', 'equals', 'password')
but it made no difference and returned the same error.
Am I using the wrong method?
Is it possible to reach the desired answer from this method?
Or I have to change my method.
My request (JSON):
{
"username":"[email protected]",
.
.
.
"password":"123654s",
"password_confirmation":"123654s",
.
.
.
"name" : "Milito"
}
And I used POST
HTTP method