Parse, validate and format common fields in an easy way.
You can install the package via composer:
$ composer require vesperabr/fieldtize
Every field class has at least this methods:
make()
Returns the field class instance.original()
Returns the original value passed to the class.get()
Returns the formatted value or null if value is invalid.raw()
Returns the value without any masks or null if value is invalid.isValid()
Returns true or false if value is invalid.
use Vespera\Fieldtize\Fields\Phone;
$phone = Phone::make('1144443333');
$phone->original(); // '1144443333'
$phone->get(); // '(11) 4444-3333'
$phone->raw(); // '+551144443333'
$phone->isValid(); // true
echo $phone; // '(11) 4444-3333'
- Phone field:
getUri()
method - Phone field:
getWhatsappUri()
method - Phone field:
getInternationalNumber()
method - Phone field:
getType()
method - Phone field:
getCountry()
method - CPF field
- CNPJ field
- CPF/CNPJ field
- CEP field
- E-mail field
$ composer test
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.