Questions tagged [respect-validation]

A validation engine created for PHP, by Alexandre Gomes Gaigalas ( Copyright (c) 2009-2015). PHP 5.4+ or HHVM 3.3+ are required for using it.

The creators call it "The most awesome validation engine ever created for PHP."

  • Fluent/Chained builders like:

    v::numeric()->positive()->between(1, 256)->validate($myNumber) 
    
  • Informative, awesome exceptions;

  • More than 30 fully tested validators.

Source:http://documentup.com/Respect/Validation/#

61 questions
0
votes
0 answers

PHP Respect Validation password confirmation

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…
Milito
  • 1
  • 3
0
votes
2 answers

How to access a json child in php respect validation?

I'm trying to validate the following json file but I can't find the way to access the "Address" child, how should I do it? Everything goes fine until it tries to access the "address" field. Json: { "first_name": "Test", "last_name": "Test", "email":…
Fran
  • 51
  • 2
  • 11
0
votes
1 answer

How to validate a email list using Respect Validation

I'm using Respect Validation classes and I want to validate a list of email separated by , or ; and spaces like: mymail1@mydomain.com; mymail2@mydomain.com,mymail3@mydomain.com ;mymail4@mydomain.com; I cannot use the standard email() rule and I did…
Tobia
  • 9,165
  • 28
  • 114
  • 219
0
votes
1 answer

How to add Respect Validation on child Object which is Optional

In Slim3 framework's Respect Validation, I am trying to add validation on child object. $childObjValidationArr = array( 'param1' => v::regex("/^[A-Za-z0-9]{1}[A-Za-z0-9.$#-@]{1,19}$/"), 'param2' => v::date('Y-m-d'), 'param3' =>…
Anup B
  • 87
  • 7
0
votes
1 answer

Respect Validating optional input array for specific fields

I have a registration input that can be used by a consumer or a fleet consumer. Depending on what they are, depends on if they send extra details about their fleet or not. A regular consumer will just send their information, where as a fleet…
Phil
  • 83
  • 1
  • 2
  • 15
0
votes
1 answer

Respect validation not able to validate array items

I am using respect built in validation from this source in my php application "https://respect-validation.readthedocs.io/en/1.1/rules/Each/". I am passing data via ajax call to php application code like print_r($itemsArray); Array ( [0] =>…
Nida Amin
  • 735
  • 1
  • 8
  • 28
0
votes
1 answer

Unable to catch exception from assert method using Respect Validation

I'm using Respect Validation to attempt to validate data sent via a POST request. In doing so I discovered an issue where an exception in the Respect Validation library is not being caught. $postValidator = v::key('name', v::stringType()->length(3,…
BugHunterUK
  • 8,346
  • 16
  • 65
  • 121
0
votes
1 answer

Multiple rules/error messages inside a custom rule in Respect\Validation?

Say you have a custom rule like this:
IMB
  • 15,163
  • 19
  • 82
  • 140
0
votes
1 answer

File/Image validation in slim framework Request validation

I wanted to validate the uploaded image with following parameters like size should not be greater than 100KB, file can be of types [jpg,png,gif]. Please help me to write validation rules for this in Slim framework. I'm using Respect…
Saurabh Sharma
  • 463
  • 2
  • 7
  • 20
0
votes
1 answer

Respect Validation: What's the right validation rule when a form has several fields with the same name?

I have a form that has only fields: question choice Choice is an array because a question has more than answers and the user can add as many as I need. I just need to validate that these aren't empty so I tried: $validation =…
ffuentes
  • 1,042
  • 5
  • 16
  • 36
0
votes
1 answer

Translating or writing custom messages on Respect/Validation

I'm using Respect to validate some forms in a project but this project is in Spanish and I don't understand how messages work after spending a long time reading the documentation and even its code. I'm using Slim and I'm using a…
ffuentes
  • 1,042
  • 5
  • 16
  • 36
0
votes
0 answers

Respect Validation - Usage Not & One Of

The user enters his/her business name. Every this is allowed except special characters. Instead of a white list I would want to main a blacklist. Here's my piece of code 'nameofbusiness' => v::not ( v::oneOf ( …
Indark
  • 322
  • 1
  • 2
  • 14
0
votes
1 answer

Dynamically assign validation parameters in Respect Validations

My initial question was how to do dynamic chaining of Respect validations. My implementation was like following, $validator = v::notEmpty(); foreach ($validations as $validation) { $variable = (string)$validation['validatorName']; …
Yasiru Nilan
  • 447
  • 5
  • 28
0
votes
1 answer

How to custom error messages

Hi everyone and thanks for your help. I'll like to custom error messages for validation and eventually to create different version for each language, it's possible ? Here my code in his actually state. namespace App; use…
Rifton007
  • 291
  • 1
  • 5
  • 24
0
votes
1 answer

How to change the default message in Respect Validation?

I use Respect Validation for password matches on a Slim app: class PasswordController extends Controller { ; ; public function postChangePassword($request, $response) { $validation = $this->validator->validate($request, [ …
blsn
  • 1,077
  • 3
  • 18
  • 38