2017 © Pedro Peláez
 

library frobou-validator

Frobou Validator

image

frobou/frobou-validator

Frobou Validator

  • Wednesday, March 28, 2018
  • by blobs.frobou
  • Repository
  • 2 Watchers
  • 0 Stars
  • 262 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 13 Versions
  • 3 % Grown

The README.md

frobou-validator

SensioLabsInsight, (*1)

validate some data, like min value, max value, email, etc.
data must be a stdClass object.
Now with logs..., (*2)

usage:, (*3)

$this->data = [];
$this->object = new \stdClass();
$log = new Logger('log-test');
$log->pushHandler(new StreamHandler(__DIR__.'/logs/log-test.log', Logger::INFO));
$this->validator = new FrobouValidator(); // or $this->validator = new FrobouValidator($log);
public function testValidateDateEnOk()
{
    $this->data['date_en'] = [];
    $this->object->dt_1 = '2015-11-22';
    $this->object->dt_2 = '2016-02-09';
    array_push($this->data['date_en'], clone $this->object, ['dt_1', 'dt_2']);
    $this->assertTrue($this->validator->validate(['date_en'], $this->data, true));
}

public function testValidateDateEnFail()
{
    $this->data['date_en'] = [];
    $this->object->dt_1 = '1';
    $this->object->dt_2 = '1';
    array_push($this->data['date_en'], clone $this->object, ['dt_1', 'dt_2']);
    $this->assertArrayHasKey('date_en', $this->validator->validate(['date_en'], $this->data, true));
}

sample data:, (*4)

array_push($this->data['integer'], clone $this->object, ['start', 'qtty']);
array_push($this->data['struct'], clone $this->object, ['start', 'qtty', 'pastel'], ['pimponeta']); //['pimponeta'] is an optional array
array_push($this->data['required'], clone $this->object, ['start', 'qtty', 'pastel']);
array_push($this->data['values'], clone $this->object, ['pastel'], ['carne', 'queijo', 'ovo']);
array_push($this->data['maxlen'], clone $this->object, ['pastel' => 12, 'start' => 3]);
array_push($this->data['minlen'], clone $this->object, ['pastel' => 5, 'start' => 2]);
array_push($this->data['min'], $this->object, ['start' => 1, 'qtty' => 1]);
array_push($this->data['max'], $this->object, ['start' => 1, 'qtty' => '1']);
array_push($this->data['email'], clone $this->object, ['email']);
array_push($this->data['ip'], clone $this->object, ['ip_1', 'ip_2']);
array_push($this->data['date_en'], clone $this->object, ['dt_1', 'dt_2']);

The Versions

28/03 2018

dev-master

9999999-dev http://frobou.com.br

Frobou Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fabio Pimenta

25/10 2017

0.0.13

0.0.13.0 http://frobou.com.br

Frobou Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fabio Pimenta

19/10 2017

0.0.12

0.0.12.0 http://frobou.com.br

Frobou Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fabio Pimenta

12/10 2017

0.0.11

0.0.11.0 http://frobou.com.br

Frobou Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fabio Pimenta

29/09 2017

0.0.10

0.0.10.0 http://frobou.com.br

Frobou Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fabio Pimenta

28/09 2017

0.0.9

0.0.9.0 http://frobou.com.br

Frobou Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fabio Pimenta

26/09 2017

0.0.8

0.0.8.0 http://frobou.com.br

Frobou Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fabio Pimenta

25/05 2017

0.0.7

0.0.7.0 http://frobou.com.br

Frobou Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fabio Pimenta

13/05 2017

0.0.6

0.0.6.0 http://frobou.com.br

Frobou Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fabio Pimenta

05/01 2017

0.0.5

0.0.5.0 http://frobou.com.br

Frobou Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fabio Pimenta

12/12 2016

0.0.4

0.0.4.0 http://frobou.com.br

Frobou Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fabio Pimenta

23/11 2016

0.0.3

0.0.3.0 http://frobou.com.br

Frobou Validator

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fabio Pimenta

16/11 2016

0.0.2

0.0.2.0 http://frobou.com.br

Frobou Validator

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Fabio Pimenta