thiagoprz / cpfcnpj-validator
Laravel package to validate CPF (Brazilian taxpayer identification number) and CNPJ (national registry of legal entities in Brazil)
0.0.6
2022-04-06 17:30 UTC
Requires
- php: ^7.1.3 || ^8.0
- illuminate/support: ^5.5 || ^6.0 || ^7.0 || ^8.0
Requires (Dev)
- orchestra/testbench: ^3.8
- phpunit/phpunit: ^8.3@dev
README
A Laravel package to validate CPF and CNPJ requested on the same input.
CPF
CPF is an individual taxpayer identification number given to people living in Brazil, both native Brazilians and resident foreigners.
CNPJ
CNPJ is the National Registry of Legal Entities in Brazil.
Installation
composer require thiagoprz/cpfcnpj-validator
Usage
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class CnpjController extends Controller
{
...
/**
* Store action
*/
public function store(Request $request)
{
$this->validate($request, [
'cnpj_cnpj' => 'required|string|cpfcnpj',
...
]);
...
}
...
}