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
1 answer

Respect\Validation - validate string if not empty, otherwise return true

I'm using Respect\Validation for validate fields. Some of my fields are not mandatory, as the phone number, but if they are not empty they must be validated. Following my current code: v::Phone()->validate($phoneNumber); // it should return true if…
Bob
  • 159
  • 7
0
votes
2 answers

Slim Application Error: Respect\Validation\Validator

I get this error when trying to Validate my OrderForm.php. If someone followed Codecourse Shopping Cart Tutorial you may know why I get this error. Here is my code in some of my files that I think is most relevant to this error and of course the…
0
votes
1 answer

Respect\Validation\Validator - using an array while catching errors

I am attempting to catch errors utilizing the Respect\Validation\Validator opensource PHP class. I used their example to create an array of checks. Although that seems to work ok, I then attempted to catch any error messages so that I could…
Shackrock
  • 4,601
  • 10
  • 48
  • 74
0
votes
1 answer

Php Respect\Validation libary exceptions shows errors but validate method returns true

im using https://github.com/Respect/Validation for validation. the package looked verry good so now i wanted to try it. I wanted to add some validation rules to a (decoded) jtw token, wich is a php object. and the validation method worked. Now i…
Reza
  • 880
  • 1
  • 10
  • 29
0
votes
1 answer

Respect validation custom rule errors on exception

I made an custom rule that checks if the given value equals the password of the user. It works but when i give an wrong password it doesn't display my custom exception message. instead it has an fatal error: Fatal error: Class…
Bart Kalkman
  • 103
  • 1
  • 10
0
votes
1 answer

Respect Validation - Returning a single error

I'm using Respect Validation. Is it possible to return a single error instead of a bag of errors? Current I can get the first error using the following: public function checkUsername(Request $request, Response $response, $args = []) { $body =…
BugHunterUK
  • 8,346
  • 16
  • 65
  • 121
0
votes
1 answer

PHP Respect Validation Pull Request Fails Travis, Why?

I have updated the grammar in PHP's Respect Validation, but the Travis CI fails each time, even though I have only deleted a few chars using the Github editor, then submitted changes as Pull Request.…
Ian N
  • 55
  • 7
0
votes
1 answer

Class validator not found in respect validation Lib

I'm new in composer but I could get vendor, composer.lock and composer.json from cmd then I paste them to my project without Validation_Master folder. My project Path: C:\wamp64\www\php Projects\project 1\(here there are test.php and vendor,…
pedram64
  • 37
  • 1
  • 7
0
votes
1 answer

Slim3 right way to set errors and check is user logged in

I'm a new user of Slim framework, I've a simple Slim 3 application, with sign in and sign up validation. But I'm not really sure if this is the right/best way to set errors and check if user is logged in -In order to redirect it to his account if…
Yassine Addi
  • 47
  • 1
  • 8
0
votes
1 answer

Validate PHP Array Key>Value

Having an array like [1] $arr = array( array( "ignoreMe" => "123", "checkMe" => "value", ), array( "ignoreMe" => "456", "checkMe" => "value", ), ); I'd like to check…
paskl
  • 589
  • 4
  • 25
0
votes
0 answers

Respect Validation and reset connection

I'm using the Respect\Validation library and I cannot get meaningful exceptions to print out apart from the first message. This code gives me an error: try { $foo = \Respect\Validation\Validator::notEmpty(); $foo->assert(''); } catch…
rink.attendant.6
  • 44,500
  • 61
  • 101
  • 156
0
votes
1 answer

idiorm with respect validation attribute method always fails

Has anyone been able to succssesfuly use the Respect Validation library with an Idiorm result object? It appears as though Respect Validation will only work on vanilla, not sure if that's the correct term, objects. Idiorm result objects allow you to…
0
votes
1 answer

Respect/Validation email() don't work

I use Respect/Validation and when I use email()...the problem is: if I validate a string: validator::email()->validate('hello@helloworld.com'); it work! if I validate a variable: validator::email()->validate($_POST['email']); it doesn't work! I try…
Matteo Calò
  • 361
  • 1
  • 2
  • 15
0
votes
0 answers

Don't found a class php imported with composer

in my project I have imported by composer respect/validator. Now, I have a file (login.php) in a subfolder of subfolder where I need it. The Respect/Validation's documentation says write:
Matteo Calò
  • 361
  • 1
  • 2
  • 15
-1
votes
1 answer

Respect validation for Select

I'm using Respect validation for my PHP form. It works fine for all elements but not sure which validation rule to use for the country select element. The default value (when the select box displays 'Please select one') is -1. In all other cases,…
cesarcarlos
  • 1,271
  • 1
  • 13
  • 33