xefi / faker-php-locales-pt-br
Faker extension to include pt_BR locale
v1.0.1
2026-11-18 10:24 UTC
Requires
- php: ^8.3
- psr/container: ^2.0
- xefi/faker-php: ^1.5.3
Requires (Dev)
- phpunit/phpunit: ^11
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Brazilian Portuguese (pt_BR) locale for Faker PHP.
Installation
composer require --dev xefi/faker-php-locales-pt-br
The service provider is discovered automatically through Composer.
Usage
use Xefi\Faker\Faker; $faker = new Faker('pt_BR'); $faker->name(); $faker->fullAddress(); $faker->cpf();
The package provides pt_BR variants of the address, colors, company, financial, person, phone and text
extensions. Generators without a pt_BR variant fall back to the default locale.
Locale-specific generators
| Method | Extension | Description |
|---|---|---|
cpf() |
PersonExtension |
CPF with valid check digits, 000.000.000-00 (pass false for digits only) |
cnpj() |
CompanyExtension |
CNPJ with valid check digits, 00.000.000/0001-00 (pass false for digits only) |
state() |
AddressExtension |
State keyed by its UF code, e.g. ['SP' => 'São Paulo'] |
postcode() |
AddressExtension |
CEP in the 00000-000 format |
iban() |
FinancialExtension |
Brazilian IBAN (BR, 29 characters) |
Contributing
- Fork the repository and create a branch from
main. - Add or update an extension under
src/Extensions/and register it inFakerPtBrServiceProvider::boot(). - Add a test under
tests/Unit/. - Run the suite with
vendor/bin/phpunit(ordocker compose run php vendor/bin/phpunit). - Open a pull request against
main.
License
MIT