sysvale / helpers
Helper function in PHP
2.5
2026-03-04 13:03 UTC
Requires
- php: >=7.4
Requires (Dev)
- php: >=7.4
- fzaninotto/faker: ^1.9
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.7.
- dev-master
- 2.5
- 2.3
- 2.2
- 2.1
- 2.0
- 1.1
- 1.0
- dev-document-helper-methods-6476553905513829668
- dev-hotfix/version
- dev-feature/refactor-dates-to-carbon-7993681689843259937
- dev-update-cns-validation-starting-with-5-342378906075137649
- dev-fix-gh-actions-queued-state-11626633932982256339
- dev-feature/issue-51-month-abbr-9740604855527301040
- dev-geidsonc-patch-1
- dev-hotfix/add-mask-cns
- dev-feature/validation-pis-pasep
- dev-bugfix/replace-faker
- dev-feature/php7.4
- dev-feature/valida-cns
- dev-add-license-1
- dev-feature/add-requirement-for-project-in-readme
- dev-feature/install-faker-generator
- dev-fix-travis-link
- dev-documentation-example
This package is auto-updated.
Last update: 2026-03-06 20:10:57 UTC
README
PHP functions to make you work faster.
Sysvale Helpers requires PHP >= 7.2 and php-mbstring extension
Installation
With composer:
composer require sysvale/helpers
Helpers class methods
- 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
Usage Examples
maskBank
use Sysvale\Helpers; $bankNumber = 12345; $maskedBank = Helpers::maskBank($bankNumber); // $maskedBank will be 1234-5
maskCpf
use Sysvale\Helpers; $cpf = '12345678901'; $maskedCpf = Helpers::maskCpf($cpf); // $maskedCpf will be 123.456.789-01
unMaskCpf
use Sysvale\Helpers; $cpf = '123.456.789-01'; $unMaskedCpf = Helpers::unMaskCpf($cpf); // $unMaskedCpf will be 12345678901
maskPhone
use Sysvale\Helpers; $phone = '79988001010'; $maskedPhone = Helpers::maskPhone($phone); // $maskedPhone will be (79) 98800-1010
maskMoney
use Sysvale\Helpers; $value = 1234.56; $maskedMoney = Helpers::maskMoney($value); // $maskedMoney will be 1.234,56
maskCep
use Sysvale\Helpers; $cep = '49000000'; $maskedCep = Helpers::maskCep($cep); // $maskedCep will be 49000-000
maskCnpj
use Sysvale\Helpers; $cnpj = '12345678000199'; $maskedCnpj = Helpers::maskCnpj($cnpj); // $maskedCnpj will be 12.345.678/0001-99
trimpp
use Sysvale\Helpers; $text = " Text \t \n "; //String with spaces and special caracter; $text = Helpers::trimpp($text); // $text will be Text
urlNoCache
use Sysvale\Helpers; $url = 'http://url.com.br'; $url = Helpers::urlNoCache($url); // $url will be http://url.com.br?1570588480
Validate class
The validation methods can be accessed directly in the Validate class.
To use the class import as in the example:
use Sysvale\Helpers\Validate;
Validate class methods
Use exemples
isValidCpf
use Sysvale\Helpers\Validate; $value = '334.734.750-17'; $isValid = Validate::isValidCpf($value); // true
isValidCnpj
use Sysvale\Helpers\Validate; $value = '56.396.710/0001-37'; $isValid = Validate::isValidCnpj($value); // true
isValidPhone
use Sysvale\Helpers\Validate; $value = '79988001010'; $isValid = Validate::isValidPhone($value); // true
isValidResidentialPhone
use Sysvale\Helpers\Validate; $value = '7033662200'; $isValid = Validate::isValidResidentialPhone($value); // true
isValidMobilePhone
use Sysvale\Helpers\Validate; $value = '70993662200'; $isValid = Validate::isValidMobilePhone($value); // true
Contributing Guidelines
If you are interested in contributing, please read and abide by the contributing guidelines.