定制 liorchamla/faker-prices 二次开发

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

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

liorchamla/faker-prices

最新稳定版本:2.0.0

Composer 安装命令:

composer require liorchamla/faker-prices

包简介

Provides typical and credible prices for Faker (fzaninotto/faker or fakerphp/faker) library

README 文档

README

Providing typical and credible prices for fzaninotto/faker !

Contents

  1. Installation
  2. Basic Usage
  3. Details

Installation

composer require liorchamla/faker-prices

Basic Usage

You just have to add the Prices provider to Faker as any other provider :

<?php
// Adding the provider to Faker
$faker = \Faker\Factory::create();
$faker->addProvider(new Liior\Faker\Prices($faker));

// Using the provider :
echo $faker->price(); // prints 49.99

Details

You can use several parameters :

// Function signature :
$faker->price($min = 1000, $max = 20000, $psychologicalPrice = true, $decimals = true)

// You can cancel the $psychologicalPrice (which gives you credible prices like 29.49 or 119.99 instead of random 23.49 or 102.49)
$faker->price(100, 200, false); // 113.49
$faker->price(100, 200, true); // 109.49

// You can cancel the $decimals also (decimals can be X.29, X.49 or X.99)
$faker->price(100, 200, true, false); // 109
$faker->price(100, 200, true, true); // 109.49

统计信息

  • 总下载量: 26.44k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-19