PHP code example of samuelpietro / cnpjutils

1. Go to this page and download the library: Download samuelpietro/cnpjutils 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/ */

    

samuelpietro / cnpjutils example snippets


   use CNPJUtils\CNPJ;
   CNPJ::gerar(); // Retorna uma ‘string’ contendo um CNPJ aleatório
   

   use CNPJUtils\CNPJ;
   CNPJ::validar('12ABC34501DE35'); // Retorna true se o CNPJ for válido e false se for inválido
   

   use CNPJUtils\CNPJ;
   CNPJ::mascarar('12ABC34501DE35'); // Retorna uma ‘string’ contendo o CNPJ formatado
   

   use CNPJUtils\CNPJ;
   CNPJ::removerMascara('12.ABC.345/01DE-35'); // Retorna uma ‘string’ contendo o CNPJ sem máscara
   

    use CNPJUtils\DigitoVerificador();
    DigitoVerificador::calcular('12ABC34501DE'); // Retorna uma ‘string’ contendo os dígitos verificadores