PHP functions to make you work faster.
Sysvale Helpers requires PHP >= 7.2 and php-mbstring extension
With composer:
composer require sysvale/helpers- maskBank
- maskCpf
- unMaskCpf
- maskPhone
- maskMoney
- maskCep
- maskCnpj
- trimpp
- titleCase
- firstUpper
- urlNoCache
- ptDate2IsoDate
- regexAccents
- toInt
- toFloat
- toTime
- toArray
- toArrayInt
- toData
- toBool
- toBoolNotNull
- removeAccents
- compareVersion
- monthPt
- removeCrassLetters
- validateCpf
- validateCNPJ
- validatePhone
- weekDay
- validateResidentialPhone
- validateMobilePhone
- getNFirstWords
use Sysvale\Helpers;
$bankNumber = 12345;
$maskedBank = Helpers::maskBank($bankNumber);
// $maskedBank will be 1234-5use Sysvale\Helpers;
$cpf = '12345678901';
$maskedCpf = Helpers::maskCpf($cpf);
// $maskedCpf will be 123.456.789-01use Sysvale\Helpers;
$cpf = '123.456.789-01';
$unMaskedCpf = Helpers::unMaskCpf($cpf);
// $unMaskedCpf will be 12345678901use Sysvale\Helpers;
$phone = '79988001010';
$maskedPhone = Helpers::maskPhone($phone);
// $maskedPhone will be (79) 98800-1010use Sysvale\Helpers;
$value = 1234.56;
$maskedMoney = Helpers::maskMoney($value);
// $maskedMoney will be 1.234,56use Sysvale\Helpers;
$cep = '49000000';
$maskedCep = Helpers::maskCep($cep);
// $maskedCep will be 49000-000use Sysvale\Helpers;
$cnpj = '12345678000199';
$maskedCnpj = Helpers::maskCnpj($cnpj);
// $maskedCnpj will be 12.345.678/0001-99use Sysvale\Helpers;
$text = " Text \t \n "; //String with spaces and special caracter;
$text = Helpers::trimpp($text);
// $text will be Textuse Sysvale\Helpers;
$url = 'http://url.com.br';
$url = Helpers::urlNoCache($url);
// $url will be http://url.com.br?1570588480The validation methods can be accessed directly in the Validate class.
To use the class import as in the example:
use Sysvale\Helpers\Validate;use Sysvale\Helpers\Validate;
$value = '334.734.750-17';
$isValid = Validate::isValidCpf($value);
// trueuse Sysvale\Helpers\Validate;
$value = '56.396.710/0001-37';
$isValid = Validate::isValidCnpj($value);
// trueuse Sysvale\Helpers\Validate;
$value = '79988001010';
$isValid = Validate::isValidPhone($value);
// trueuse Sysvale\Helpers\Validate;
$value = '7033662200';
$isValid = Validate::isValidResidentialPhone($value);
// trueuse Sysvale\Helpers\Validate;
$value = '70993662200';
$isValid = Validate::isValidMobilePhone($value);
// trueIf you are interested in contributing, please read and abide by the contributing guidelines.