Biblioteca PHP para validação de padrões brasileiros

Overview

BrCommons Validators

Total Downloads License

BrCommons validator is a set of usefull validators that helps you develop fast and realiable code.

Installation by composer

Run composer require fernandorech/br-commons.

BrCommons

It's a class that helps you to validate and format CPF and CNPJ by given a string.

Examples 1: Simple document format

use BrCommons\BrCommons;
    $document = BrCommons::from('44975583046');
    echo $document->toString(); // will print '449.755.830-46'

Example 2: validation of a cpf

    if(BrCommons::isValid('44975583046') {
        // do some code
    } else {
        // other stuff
    }

Example 3: throw an exception if a document is not valid

try {
    $document = BrCommons::from('4497558', true); //it will thrown an exception
} catch (DocumentException $e) {
    //do code
}

Example 4: Return formatted value without create an object

echo BrCommons::format('44975583046');

Example 5: Use CPF or CNPJ directly

$cpf = CPF::from('44975583046');
$cnpj  CNPJ::from('14328920000148');
You might also like...
PHP Framework for building scalable API's on top of Laravel.
PHP Framework for building scalable API's on top of Laravel.

Apiato Build scalable API's faster | With PHP 7.2.5 and Laravel 7.0 Apiato is a framework for building scalable and testable API-Centric Applications

A PHP framework for console artisans
A PHP framework for console artisans

This is a community project and not an official Laravel one Laravel Zero was created by, and is maintained by Nuno Maduro, and is a micro-framework th

PHP Framework for building scalable API's on top of Laravel.
PHP Framework for building scalable API's on top of Laravel.

Apiato Build scalable API's faster | With PHP 7.2.5 and Laravel 7.0 Apiato is a framework for building scalable and testable API-Centric Applications

A boilerplate single php file for all your needs, no frameworks, no libraries.

SINGLE PHP FILE A boilerplate single php file for all your needs, no frameworks, no libraries. Avoid repetitive work It is a well known architecture d

PHP Laravel, MySQL and AIML chatbot engine and admin portal

Lemur Engine The Lemur Engine is a PHP/MySQL/AIML Chatbot. Written using the Laravel Framework. Demo You can demo the bot at the website: https://lemu

Generate dummy API endpoints from a simple PHP array.

Laravel Fake API Create placeholder API endpoints from a simple PHP array. LFA utilizes Faker for dummy data. Inspired by JSON Server. Installation To

PHP Başlangıç Yapısı

PHP Boilerplate Bu başlangıç yapısını derslerde birlikte oluşturmaya başladık. Kurulum Bu boilerplate'i kurmak için yapmanız gereken öncelikle repoyu

A PHP based membership (registration/login) code

Simple Registration/Login code in PHP Read more:PHP registration form PHP login form Installation Edit the file membersite_config.php in the includes

Basic calculator made in PHP, CSS3 and JavaScript.
Basic calculator made in PHP, CSS3 and JavaScript.

Basic Calculator in PHP Basic calculator in PHP made for treining. 👨‍💻 Used Technology PHP HTML CSS JavaScript 📝 License This project is under MIT

Releases(1.0.1)
Owner
Fernando Rech
Fernando Rech
Panel de Control para Dominios

Panel de Control para Gestión de Dominios Esta aplicación permite la gestión interna de dominios de una manera sencilla. Podrás dar de alta dominios p

Nitsnets 23 Nov 11, 2022
Proyecto con configuraciones basicas para iniciar una aplicacion en Laravel 7

LARAVEL CORK ADMIN Proyecto base de Laravel 7, usando la plantilla de CORK en su versión 1.9. Este proyecto contiene algunos paquetes extras que ayuda

TonyStore 3 Apr 25, 2022
Herramienta Para Snipear Nitros Y Participar En Sorteos Automaticamente

Crips Nitro Sniper Discord Nitro Sniper Y Auto Participar En Sorteos ⚠️ Es Bastante Rapido Y Efectivo Hecho En Python Como Usar ( Python ) : python -m

null 1 Oct 27, 2021
Web scrapper para cotizar articulos

WebScrapper Este web scrapper esta desarrollado en python 3.10.0 para buscar en la pagina de cyber puerta articulos dentro del catalogo. El programa t

Jordan Gaona 1 Oct 27, 2021
Setup Docker Para Projetos Laravel

Setup Docker Para Projetos Laravel

EspecializaTi 9 Sep 13, 2022
Projeto de locadora de carros, apenas a carater de estudos para praticar o uso de APIs

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Samuel Nunes de Souza 3 Nov 30, 2021
Projeto CRUD para gestão de clientes com consumo da API ViaCep

CRUD-Clientes-API Projeto CRUD para gestão de clientes com consumo da API ViaCep Requisitos PHP 7.4 MySQL Configuração do banco de dados Executar a qu

Bruno Vieira 4 Sep 8, 2022
Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern PHP design pattern foundation.

Someline Starter PHP Framework Tested and used in production by Someline Inc. Someline Starter is a PHP framework for quick building Web Apps and Rest

Someline 844 Nov 17, 2022
Gestor de Contraseñas basado en Laravel 8 + PHP 8 + MySQL 8. Self-hosted Password Manager based on Laravel 8 + PHP 8 + MySQL 8.

English Gestor de Contraseñas Esta aplicación permite una gestión completa de contraseñas para múltiples tipos de servicios (web, ssh, teléfonos, wifi

Lito 134 Jan 2, 2023
A PHP notebook application build with PHP Symfony as back-end API and VueJS/Vuetify front-end.

PHPersonal Notes ?? - BETA RELEASE PHPersonal notes is an application to store your personal notes! PHPersonalnotes is build with Symfony/VueJS/Vuetif

Robert van Lienden 3 Feb 22, 2022