2017 © Pedro Peláez
 

library seequest

Another library to validate requests

image

mvaliolahi/seequest

Another library to validate requests

  • Saturday, July 21, 2018
  • by mvaliolahi
  • Repository
  • 1 Watchers
  • 0 Stars
  • 27 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

PHP Request Validator

Latest Stable Version Total Downloads Build Status StyleCI PHP-Eye, (*1)

Validate requests in easiest way!, (*2)

Install

`composer require mvaliolahi/seequest`
usage
$validator = new SeeQuest('en');

$result = $validation->check($request, [
    'name' => 'required',
    'email' => 'required|email'
    'age'=> 'required|between:1,25',
    'score' => 'min:10',
    'high_score'=> 'max:600' 
]);

$err = $validator->getErrors();
Create custom validator

Create a class and extends from Mvaliolahi\SeeQuest\Contracts\Validator, it done!, (*3)

just implement validate() method., (*4)

you have access to :, (*5)

Request => $this->request
Attribute => $this->attribute
Value => $this->value
Rule => $this->rule
Rule-Option => $this->option
example:
<?php

namespace Mvaliolahi\SeeQuest\Validators;


use Mvaliolahi\SeeQuest\Contracts\Validator;

class Between extends Validator
{
    public $alias = 'between';

    public function validate()
    {
        $number = explode(',', $this->option);

        if (!($this->value >= $number[0] && $this->value <= $number[1])) {
            return $this->message();
        }
    }

    public function message()
    {
        return $this->translation->of($this->alias, [
            'attribute' => $this->attribute,
            'option' => $this->option,
        ]);
    }
}

After define your custom validator you should pass it to the Validator class:, (*6)

$validator = new SeeQuest('en', [ BetweenSample::class ]);

Form Request

There is another class to create FormRequest, its very simple! you can use it to create amazing validation form! just look at the source code., (*7)

The Versions

21/07 2018

dev-master

9999999-dev https://mvaliolahi.ir

Another library to validate requests

  Sources   Download

The Development Requires

by Meysam Valiolahi

php validation request mvaliolahi

26/02 2018

v0.0.2

0.0.2.0 https://mvaliolahi.ir

Another library to validate requests

  Sources   Download

The Development Requires

by Meysam Valiolahi

php validation request mvaliolahi

26/02 2018

dev-fix-warnings

dev-fix-warnings https://mvaliolahi.ir

Another library to validate requests

  Sources   Download

The Development Requires

by Meysam Valiolahi

php validation request mvaliolahi

30/10 2017

0.0.1

0.0.1.0 https://mvaliolahi.ir

Another library to validate requests

  Sources   Download

The Development Requires

by Meysam Valiolahi

php validation request mvaliolahi