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/#

57 questions
1
vote
0 answers

Password validation with Respect Validation

I've currently got a regular expression set up for validating my passwords: /^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*\W).{6,}$/ This checks for at least 1 uppercase and lowercase character, 1 digit, 1 special character/non-word character and minimum of…
no.
  • 2,241
  • 3
  • 25
  • 40
1
vote
1 answer

PHPStan throws undefined static method when using custom rules in Respect/Validation

I'm using Respect/Validation class and I have custom rule CustomRule() which works fine: use Respect\Validation\Validator as v; // ... 'email' => v::CustomRule()->email()->setName('email'); But this causes PHPStan to throw an error: Call to an…
IMB
  • 12,083
  • 16
  • 59
  • 118
1
vote
1 answer

snyk dependencies download issue

I am trying to install the dependencies of respec project of w3c and I am getting this error npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated. npm WARN prepublish-on-install Use `prepare` for build steps and…
1
vote
2 answers

Respect Validation for two fields

I need to validate form data with Respect. At least one of these fields must have a value: $vfname and $vlname. After some trial and error, I found that I can concatenate and test with notEmpty(): v::StringType()->notEmpty()->assert($vfname .…
WillardSolutions
  • 2,275
  • 4
  • 28
  • 33
1
vote
1 answer

How to validate $_FILES using Respect Validation library

I'm using Respect Validation to attempt to validate a file upload. The problem I'm having is the validation always fails, even though the correct image has been uploaded. Here's my code: public function updateProfilePicture(Request $request,…
BugHunterUK
  • 6,765
  • 7
  • 41
  • 94
1
vote
3 answers

Month validation with "Respect Validation"

I am trying to write validation rule for credit card month and I am using Respect Validation library for this. v::string()->date('m')->validate('02'); Result is FALSE but it must be TRUE because "02" is valid month
Farid Movsumov
  • 10,745
  • 8
  • 65
  • 92
1
vote
1 answer

PHP respect validation fatal error Class 'Respect\Validation\Validator' not found

I downloaded Respect/validation zip file from here https://github.com/Respect/Validation/archive/master.zip I unzipped the archive and added a php file named phpinfo.php @ /Validation-master/Validation-master/library/ this is the project structure…
Ananda
  • 760
  • 11
  • 17
0
votes
0 answers

Dependent parameters with Respect\Validation

I'm making input validation in my controllers using Respect\Validation library. I have two parameters that are optional but dependent, if the "a" parameter is present then I also need the "b" to be here and vice-versa and it is possible that there…
Xiidref
  • 669
  • 3
  • 14
0
votes
1 answer

Validating array of relative arrays(maps) with Respect/Validation?

I'm trying to validate to following json: { "variants": [ { "variant_code": "1", "price": 12, "discount": 12, "height": 1, "longitude": 1, "width": 1, …
0
votes
1 answer

Respect\Validation with slim4

I'm trying to follow this tutorial for add post params validation: https://odan.github.io/2020/10/08/slim4-respect-validation.html I add a lib, and use it: private function validateProperty(array $data): void { $validator = new v(); …
Phyron
  • 423
  • 1
  • 6
  • 17
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
  • 41
  • 1
  • 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
  • 8,015
  • 24
  • 90
  • 182
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
  • 73
  • 2
  • 14