PHP code example of diego-brocanelli / random-data

1. Go to this page and download the library: Download diego-brocanelli/random-data 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/ */

    

diego-brocanelli / random-data example snippets




andom\Faker;

echo (new Faker())->cpf()->generate(); // output: '64893836757'



andom\Faker;

echo (new Faker())->cpf()->generateWithMask(); // output: '648.938.367-57'



andom\Faker;

(new Faker())->cpf()->isValid('56359989093') ; //output: true

// ou

(new Faker())->cpf()->isValid('563.599.890-93') ; //output: true



andom\Faker;

echo (new Faker())->cnpj()->generate(); // output: '77496644000147'



andom\CNPJ;

echo (new Faker())->cnpj()->generateWithMask(); // output: '99.177.535/0001-08'



andom\Faker;

(new Faker())->cnpj()->isValid('99177535000108'); //output: true

// ou

(new Faker())->cnpj()->isValid('99.177.535/0001-08'); //output: true

composer analyse