Sample PHP class that generates fake data of nonexistent Danish persons.
- The fake persons' first name, last name, and gender are extracted from the file
data/person-names.json
. - The fake persons' postal code and town are extracted from the MariaDB/MySQL database
addresses
.
- The script
db/addresses.sql
must be run. It will create the MariaDB/MySQL databaseaddresses
. - The file
info/info.php
contains default database values. It may be necessary to update it with the database configuration in use.
- getCPR(): string
- getFullNameAndGender(): array
- getFullNameGenderAndBirthDate(): array
- getCprFullNameAndGender(): array
- getCprFullNameGenderAndBirthDate(): array
- getAddress(): string
- getPhoneNumber(): string
- getFakePerson(): array
- getFakePersons(int $amount): array
echo '<pre>';
$fakeInfo = new FakeInfo;
print_r($fakeInfo->getFakePersons());
Output
Array
(
[CPR] => 1909743965
[firstName] => Anton D.
[lastName] => Jespersen
[gender] => male
[birthDate] => 1974-09-19
[address] => Array
(
[street] => WTquWUqMiHLBKXcEÆnMpqhdGæzlrødfAAAJuGGXø
[number] => 456
[floor] => 61
[door] => th
[postal_code] => 3650
[town_name] => Ølstykke
)
[phoneNumber] => 55129415
)
PHP8 / MariaDB
Arturo Mora-Rioja ([email protected])