2017 © Pedro Peláez
 

library validator

provides a set of commonly needed validators

image

rsporteman/validator

provides a set of commonly needed validators

  • Monday, October 24, 2016
  • by raonibs
  • Repository
  • 0 Watchers
  • 0 Stars
  • 61 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 13 % Grown

The README.md

License: MIT codecov, (*1)

rsporteman/validator

Introduction

Code for cpf and a cnpj validation, use like Laminas validators., (*2)

Installation using Composer

$  composer require rsporteman/validator

Example

<?php

use rsporteman\Validator\Cpf;
use rsporteman\Validator\Cnpj;

$post['cpf'] = '313.734.531/68'; // it is valid
$validatorCpf = new Cpf();
$isValidCpf = $validatorCpf->isValid($post['cpf']); //output: true


$post['cnpj'] = '1364679'; //it is invalid
$validatorCnpj = new Cnpj();
$isValidCnpj = $validatorCnpj->isValid($post['cnpj']); //output: false

//Get Error messages

//return array empty because cpf is valid
$errorCnpjMsg = $validatorCpf->getMessages(); //output: []

//return array with errors messages because cnpj is invalid
$errorCpfMsg = $validatorCnpj->getMessages();
var_dump($errorCpfMsg);// output: ['cnpjLength' => string 'The input contains an invalid amount of characters']


Ambience and Tests, (*3)

#up docker container
docker-compose up 

#enter on container
docker exec -it rsporteman-validator bash

#install dependencies
composer install

#run tests
vendor/bin/phpunit 

#generate coverage, files will be generate inside .phpunit.cache
composer test:coverage
composer test:coverage-html 

The Versions

24/10 2016

dev-master

9999999-dev https://github.com/rsporteman/validator

provides a set of commonly needed validators

  Sources   Download

MIT License

The Requires

 

The Development Requires

by Raoni Sporteman

validator rsporteman

24/10 2016

0.0.5

0.0.5.0 https://github.com/rsporteman/validator

provides a set of commonly needed validators

  Sources   Download

MIT License

The Requires

 

The Development Requires

by Raoni Sporteman

validator rsporteman

24/10 2016

0.0.4

0.0.4.0 https://github.com/rsporteman/validator

provides a set of commonly needed validators

  Sources   Download

MIT License

The Requires

 

The Development Requires

by Raoni Sporteman

validator rsporteman

24/10 2016

0.0.1

0.0.1.0 https://github.com/rsporteman/validator

provides a set of commonly needed validators

  Sources   Download

MIT License

The Requires

 

The Development Requires

validator rsporteman