jansenfelipe/cpf-gratis
A compact PHP package for handling Brazilian CPF numbers. It makes it easy to validate CPF values, reject invalid documents, and add CPF checks to Laravel validators or any PHP project with minimal setup and no external dependencies.
composer require jansenfelipe/cpf-gratis. This is a Laravel 5-era package: on 5.5+ auto-discovery registers the service provider and facade; on older apps add JansenFelipe\CpfGratis\CpfGratisServiceProvider and the CpfGratis facade alias to config/app.php.src/ — the public surface is thin (essentially one lookup method returning an array/object with fields like nome, situacao, nascimento). Confirm the exact method name and response shape against the version you installed before writing code around it.php artisan tinker against a known-valid test CPF to inspect the real response shape and timing:$result = \CpfGratis::search('00000000000');
// inspect keys, nulls, and error behavior
CpfLookupService (or contract) that returns your own DTO. The package scrapes a government site; its return format and failure modes are not a stable contract you want leaking through your app.ShouldQueue job per CPF with backoff(), retryUntil(), and either the RateLimited middleware or a Redis::throttle lock. Never loop synchronously over a list — Receita will throttle or block you.CpfQueried/CpfLookupFailed event. Never block an HTTP request on the scrape.FakeCpfLookup in tests. CI should never touch the live service.LookupFailed — never as "CPF not found." A silent "not found" is the worst failure mode for a KYC/validation flow.env() reads; defaults are often tuned for a single manual query, not production throughput.How can I help you explore Laravel packages today?