xefi / faker-php-locales-nb-no
Faker extension to include nb_NO locale
v1.0.1
2026-11-18 10:23 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
Norwegian Bokmål (nb_NO) locale for Faker PHP.
Installation
composer require --dev xefi/faker-php-locales-nb-no
The service provider is discovered automatically through Composer.
Usage
use Xefi\Faker\Faker; $faker = new Faker('nb_NO'); $faker->name(); // "Ingrid Hansen" $faker->fullAddress(); // "Storgata 12, 0150 Oslo" $faker->fodselsnummer(); // "01010012356"
Generators without a nb_NO variant fall back to the default locale.
Locale-specific generators
| Method | Extension | Description |
|---|---|---|
county() / countyCode() |
Address | The 15 fylker and their fylkesnummer |
postcode() |
Address | 4 digits postnummer |
fodselsnummer(?string $gender, bool $formatted) |
Person | Fødselsnummer with both control digits |
companyNumber() |
Company | Organisasjonsnummer passing the modulus 11 check |
vat() |
Company | NO + organisasjonsnummer + MVA |
iban() |
Financial | NO IBAN with a valid national modulus 11 check digit |
Contributing
- Fork the repository and create a branch from
main. - Add an extension under
src/Extensions/and register it inFakerNbNoServiceProvider::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