oni4i/fake-nz-generator

该软件包最新版本(1.3)没有可用的许可证信息。

模拟新西兰数据生成器

1.3 2023-08-17 13:53 UTC

This package is auto-updated.

Last update: 2024-09-01 22:07:19 UTC


README

生成新西兰有效数据(如IP地址、邮编和城市)的生成器

composer require oni4i/fake-nz-generator

如果您需要模拟但有效的数据,如IP地址、ZIP代码和城市,可以使用此PHP库。

生成随机城市

$cityGenerator = new CityGeneratorService();

//output "Ahaura"
$randCity1 = $cityGenerator->rand();

//output "Athol"
$randCity2 = $cityGenerator->rand();

生成IP地址

$ipGenerator = new IPGeneratorService();

//output "14.1.32.0"
$firstIP = $ipGenerator->first();

//output "14.1.32.1"
$nextIP = $ipGenerator->next($firstIP);

//output "14.1.32.0"
$prevIP = $ipGenerator->prev($firstIP);

//output "14.1.95.255"
$randIP = $ipGenerator->rand();

生成ZIP代码

$zipGenerator = new ZipGeneratorService();

//output "7550"
$randZipCode = $zipGenerator->rand();

//output "9749"
$randZipCodeByCity = $zipGenerator->randByCity('Athol');