PHP code example of rcngo / cpfcnpj

1. Go to this page and download the library: Download rcngo/cpfcnpj library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rcngo / cpfcnpj example snippets


{
    "  "rcngo/cpfcnpj": "1.0.*"
    }
}


cnpfcnpj::removeMaskCpfOrCnpj('000.000.000-00');
// return cpf string 00000000000

cnpfcnpj::removeMaskCpfOrCnpj('00.000.000/0000-00');
// return cnpj string 00000000000000

cnpfcnpj::maskCpfOrCnpj('00000000000');
// return cpf string 000.000.000-00

cnpfcnpj::maskCpfOrCnpj('00000000000000');
// return cnpj string 00.000.000/0000-00

cnpfcnpj::cpfValidate('000.000.000-00');
// return true or false

cnpfcnpj::cnpjValidate('00.000.000/0000-00');
// return true or false