title: php respect validation just validate if not empty
body: <p>I'm using php respect validation.
  <a href="https://github.com/Respect/Validation" rel="nofollow">https://github.com/Respect/Validation</a></p>
  
  <pre><code>class UserValidator implements iValidator
  {
  
      public function validate($object)
      {
  
          $userValidator = v::attribute('email', v::email())
              -&gt;attribute('mobile', v::numeric()-&gt;length(10,12))
              -&gt;attribute('firstName', v::stringType()-&gt;length(5,255))
              -&gt;attribute('lastName', v::stringType()-&gt;length(5,255))
              -&gt;attribute('userName', v::stringType()-&gt;length(5,255)-&gt;unique('users'))
              -&gt;attribute('password', v::stringType()-&gt;length(8,16));
  
          $userValidator-&gt;assert($object);
  
      }
  
  }
  </code></pre>
  
  <p>and this is my user validation code.</p>
  
  <p>username and password are only required fields.
  I want them to be required and other field validation should be applied only if user has filled in the input.
  what should I do ?
  after all I've implemented my own rule (unique)
  if it's necessary I'm ready to develop new rules or whatever.
  also if you know better php package for input validation I'm all ears.</p>