定制 wnx/faker-swiss-locations 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wnx/faker-swiss-locations

最新稳定版本:v1.4.0

Composer 安装命令:

composer require wnx/faker-swiss-locations

包简介

Provider to generate valid Swiss location data for Faker PHP.

README 文档

README

Latest Version on Packagist Tests Total Downloads

Faker provider to generate random valid Swiss locations.

Installation

You can install the package via composer:

composer require wnx/faker-swiss-locations

Usage

You first need to add the Location provider to Faker.

// Add Location Provider to Faker
$faker = Factory::create();
$faker->addProvider(new Wnx\FakerSwissLocations\Provider\Location($faker));

You can now call the postcode(), city() or canton() method on faker to get a random valid Swiss location.

Note Calling postcode(), city() or canton() always returns a new random location. If you need the same location for postcode, city and canton use the location()-method and access the properties from the instance.

// 8000
$faker->postcode();

// Zürich
$faker->city();

// Instance of Wnx\SwissCantons\Canton
$faker->canton();
$faker->canton()->getName(); // Zürich
$faker->canton()->getAbbreviation(); // ZH

Or you can call the location() method to get a \Wnx\FakerSwissLocations\Location-instance. You can access postcode, city and canton from this object too.

// Instance of \Wnx\FakerSwissLocations\Location
$location = $faker->location();

$location->postcode; // 8000
$location->city; // Zürich
$location->canton; // Instance of Wnx\SwissCantons\Canton

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 3.44k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-19