Skip to content

Latest commit

 

History

History
150 lines (90 loc) · 2.53 KB

README.md

File metadata and controls

150 lines (90 loc) · 2.53 KB

Random Data

Focado em fornecer dados válidos aleatórios para uso em ambiente de desenvolvimento ou homologação.

Codacy Badge Code Climate SensioLabsInsight

Requisitos

PHP >= 7.4;

Instalação

composer install

Executar testes

Na raiz do projeto.

composer tests

Executar code analysis

Na raiz do projeto.

composer analyse

Executar PHP Code Sniffer

Na raiz do projeto.

composer phpcs

Executar testes, análise de código e PHP Code Sniffer

Na raiz do projeto.

composer all

Como usar o componente

composer require diego-brocanelli/money_to_word dev-main

Examplos:

CPF

Gerar

<?php

require_once __DIR__.'/vendor/autoload.php';

use Random\Faker;

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

Gerar com mascara

<?php

require_once __DIR__.'/vendor/autoload.php';

use Random\Faker;

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

Validar

<?php

require_once __DIR__.'/vendor/autoload.php';

use Random\Faker;

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

// ou

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

CNPJ

Gerar

<?php

require_once __DIR__.'/vendor/autoload.php';

use Random\Faker;

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

Gerar com mascara

<?php

require_once __DIR__.'/vendor/autoload.php';

use Random\CNPJ;

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

Validar

<?php

require_once __DIR__.'/vendor/autoload.php';

use Random\Faker;

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

// ou

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

Autor

License

MIT