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
1
vote
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
  • 613
  • 1
  • 9
  • 25
1
vote
2 answers

Respect\Validation custom Rule with PDO?

I am learning Slim Framework v4 and decided to use Respect\Validation to validate inputted data and have hit a snag where I do not know how to inject the PDO into my custom rule I created. The idea is to validate some inputs against the database if…
Kristjan O.
  • 814
  • 1
  • 9
  • 33
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,356
  • 3
  • 27
  • 42
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,316
  • 4
  • 28
  • 38
1
vote
0 answers

Validate JSON array with Respect Validation

I have the following JSON: { "articles":[ {"amount": 3, "vat": 19}, {"amount": 2, "vat": 7} ] } I want to validate that articles is an array and has the keys amount as a number and vat as a number. I'm trying the…
Florian Sauerwein
  • 445
  • 1
  • 5
  • 19
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
  • 8,346
  • 16
  • 65
  • 121
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
  • 12,350
  • 8
  • 71
  • 97
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
  • 888
  • 9
  • 19
0
votes
0 answers

Validate request data via Respect/validation

I'm using Slim PHP Framework and I need to validate POST request payload and I'm using this PHP package Respect-Validation. The idea that I have array ob objects and I need to validate the data inside each object. I used this code for validation …
Bebo
  • 5
  • 2
0
votes
1 answer

Validate JSON Request with Respect/Validation

I have a JSON request which exactly follow the rules, but the result keeps failing. Let's say I have a request like this: { "name" : "Angela White", "dateOfBirth" : "01/01/98" } and this is my controller: class RegisterController extends…
aew09
  • 1
  • 1
0
votes
1 answer

Respect/Validation - Add more rules if some condition is met

I try to find the proper logic to add some more rules on a previous rules set (that was already defined) if some condition is met. $form_validation_rules = v::key('password_current', v::length(6)) ->key('password',…
punctweb
  • 45
  • 6
0
votes
1 answer

respect validation translation issue

I have been using respect validation 1.1 and I used below code for translating messages. foreach ($rules as $field => $rule) { try { $localeField = $translator->trans($field); …
Miky
  • 11
  • 1
  • 4
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
  • 1,456
  • 8
  • 20
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, …
Francesc Arolas
  • 325
  • 1
  • 12