How to get variables from $request

Hi guys,

At the moment I am still fresh with PHP, OOP and learning everyday.

I can’t wrap my head around this issue (can’t seem to make it work). I am trying to validate to input fields with the Respect\Validation package and Slim3.

The documentation (https://github.com/Respect/Validation/blob/master/docs/KeyValue.md) says the following:

  • keyValue(string $comparedKey, string $ruleName, string $baseKey)
    Performs validation of $comparedKey using the rule named on $ruleName with $baseKey as base.

  • v::keyValue(‘password_confirmation’, ‘equals’, ‘password’)->validate($_POST);
    The above code will result on true if $_POST[‘password_confirmation’] is equals to $_POST[‘password’], it’s the same of:

This is my code:
‘password’ => v::noWhitespace()->notEmpty(),
‘confirm_password’ => v::keyValue(‘password’, ‘equals’, ‘confirm_password’)->validate($request->getParam(‘password’)),

This is the error: ‘Call to a member function setName() on boolean’

If i try:
‘confirm_password’ => v::keyValue(‘password’, ‘equals’, ‘confirm_password’),

This is the error: Key {{ keyname }} must be present.
This question is also asked (but not ansewred on Stackoverflow: http://stackoverflow.com/questions/41250041/respect-validation-keyvalue-doesnt-work-properly-with-slim3)

Also tried: ‘confirm_password’ => v::equals(‘confirm_password’)->validate(‘password’),
Error: Call to a member function setName() on boolean

How do I implement the params? What do i miss (don’t see) here?

Thanks!