# Faker
Faker is a PHP library that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in your persistence to stress test it, or anonymize data taken from a production service, Faker is for you.
Faker is heavily inspired by Perl's [Data::Faker](http://search.cpan.org/~jasonk/Data-Faker-0.07/), and by ruby's [Faker](https://rubygems.org/gems/faker).
Faker requires PHP >= 5.3.3.
[![Monthly Downloads](https://poser.pugx.org/fzaninotto/faker/d/monthly.png)](https://packagist.org/packages/fzaninotto/faker) [![Build Status](https://travis-ci.org/fzaninotto/Faker.svg?branch=master)](https://travis-ci.org/fzaninotto/Faker) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/eceb78a9-38d4-4ad5-8b6b-b52f323e3549/mini.png)](https://insight.sensiolabs.com/projects/eceb78a9-38d4-4ad5-8b6b-b52f323e3549)
# Table of Contents
- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Formatters](#formatters)
- [Base](#fakerproviderbase)
- [Lorem Ipsum Text](#fakerproviderlorem)
- [Person](#fakerprovideren_usperson)
- [Address](#fakerprovideren_usaddress)
- [Phone Number](#fakerprovideren_usphonenumber)
- [Company](#fakerprovideren_uscompany)
- [Real Text](#fakerprovideren_ustext)
- [Date and Time](#fakerproviderdatetime)
- [Internet](#fakerproviderinternet)
- [User Agent](#fakerprovideruseragent)
- [Payment](#fakerproviderpayment)
- [Color](#fakerprovidercolor)
- [File](#fakerproviderfile)
- [Image](#fakerproviderimage)
- [Uuid](#fakerprovideruuid)
- [Barcode](#fakerproviderbarcode)
- [Miscellaneous](#fakerprovidermiscellaneous)
- [Biased](#fakerproviderbiased)
- [Html Lorem](#fakerproviderhtmllorem)
- [Modifiers](#modifiers)
- [Localization](#localization)
- [Populating Entities Using an ORM or an ODM](#populating-entities-using-an-orm-or-an-odm)
- [Seeding the Generator](#seeding-the-generator)
- [Faker Internals: Understanding Providers](#faker-internals-understanding-providers)
- [Real Life Usage](#real-life-usage)
- [Language specific formatters](#language-specific-formatters)
- [Third-Party Libraries Extending/Based On Faker](#third-party-libraries-extendingbased-on-faker)
- [License](#license)
## Installation
```sh
composer require fzaninotto/faker
```
## Basic Usage
Use `Faker\Factory::create()` to create and initialize a faker generator, which can generate data by accessing properties named after the type of data you want.
```php
<?php
// require the Faker autoloader
require_once '/path/to/Faker/src/autoload.php';
// alternatively, use another PSR-0 compliant autoloader (like the Symfony2 ClassLoader for instance)
// use the factory to create a Faker\Generator instance
$faker = Faker\Factory::create();
// generate data by accessing properties
echo $faker->name;
// 'Lucy Cechtelar';
echo $faker->address;
// "426 Jordy Lodge
// Cartwrightshire, SC 88120-6700"
echo $faker->text;
// Dolores sit sint laboriosam dolorem culpa et autem. Beatae nam sunt fugit
// et sit et mollitia sed.
// Fuga deserunt tempora facere magni omnis. Omnis quia temporibus laudantium
// sit minima sint.
```
Even if this example shows a property access, each call to `$faker->name` yields a different (random) result. This is because Faker uses `__get()` magic, and forwards `Faker\Generator->$property` calls to `Faker\Generator->format($property)`.
```php
<?php
for ($i=0; $i < 10; $i++) {
echo $faker->name, "\n";
}
// Adaline Reichel
// Dr. Santa Prosacco DVM
// Noemy Vandervort V
// Lexi O'Conner
// Gracie Weber
// Roscoe Johns
// Emmett Lebsack
// Keegan Thiel
// Wellington Koelpin II
// Ms. Karley Kiehn V
```
**Tip**: For a quick generation of fake data, you can also use Faker as a command line tool thanks to [faker-cli](https://github.com/bit3/faker-cli).
## Formatters
Each of the generator properties (like `name`, `address`, and `lorem`) are called "formatters". A faker generator has many of them, packaged in "providers". Here is a list of the bundled formatters in the default locale.
### `Faker\Provider\Base`
randomDigit // 7
randomDigitNotNull // 5
randomNumber($nbDigits = NULL, $strict = false) // 79907610
randomFloat($nbMaxDecimals = NULL, $min = 0, $max = NULL) // 48.8932
numberBetween($min = 1000, $max = 9000) // 8567
randomLetter // 'b'
// returns randomly ordered subsequence of a provided array
randomElements($array = array ('a','b','c'), $count = 1) // array('c')
randomElement($array = array ('a','b','c')) // 'b'
shuffle('hello, world') // 'rlo,h eoldlw'
shuffle(array(1, 2, 3)) // array(2, 1, 3)
numerify('Hello ###') // 'Hello 609'
lexify('Hello ???') // 'Hello wgt'
bothify('Hello ##??') // 'Hello 42jz'
asciify('Hello ***') // 'Hello R6+'
regexify('[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}'); // sm0@y8k96a.ej
### `Faker\Provider\Lorem`
word // 'aut'
words($nb = 3, $asText = false) // array('porro', 'sed', 'magni')
sentence($nbWords = 6, $variableNbWords = true) // 'Sit vitae voluptas sint non voluptates.'
sentences($nb = 3, $asText = false) // array('Optio quos qui illo error.', 'Laborum vero a officia id corporis.', 'Saepe provident esse hic eligendi.')
paragraph($nbSentences = 3, $variableNbSentences = true) // 'Ut ab voluptas sed a nam. Sint autem inventore aut officia aut aut blanditiis. Ducimus eos odit amet et est ut eum.'
paragraphs($nb = 3, $asText = false) // array('Quidem ut sunt et quidem est accusamus aut. Fuga est placeat rerum ut. Enim ex eveniet facere sunt.', 'Aut nam et eum architecto fugit repellendus illo. Qui ex esse veritatis.', 'Possimus omnis aut incidunt sunt. Asperiores incidunt iure sequi cum culpa rem. Rerum exercitationem est rem.')
text($maxNbChars = 200) // 'Fuga totam reiciendis qui architecto fugiat nemo. Consequatur recusandae qui cupiditate eos quod.'
### `Faker\Provider\en_US\Person`
title($gender = null|'male'|'female') // 'Ms.'
titleMale // 'Mr.'
titleFemale // 'Ms.'
suffix // 'Jr.'
name($gender = null|'male'|'female') // 'Dr. Zane Stroman'
firstName($gender = null|'male'|'female') // 'Maynard'
firstNameMale // 'Maynard'
firstNameFemale // 'Rachel'
lastName // 'Zulauf'
### `Faker\Provider\en_US\Address`
cityPrefix // 'Lake'
secondaryAddress // 'Suite 961'
state // 'NewMexico'
stateAbbr // 'OH'
citySuffix // 'borough'
streetSuffix // 'Keys'
buildingNumber // '484'
city // 'West Judge'
streetName // 'Keegan Trail'
streetAddress // '439 Karley Loaf Suite 897'
postcode // '17916'
address // '8888 Cummings Vista Apt. 101, Susanbury, NY 95473'
country // 'Falkland Islands (Malvinas)'
latitude($min = -90, $max = 90) // 77.147489
longitude($min = -180, $max = 180) // 86.211205
### `Faker\Provider\en_US\PhoneNumber`
phoneNumber // '201-886-0269 x3767'
tollFreePhoneNumber // '(888) 937-7238'
e164PhoneNumber // '+27113456789'
### `Faker\Provider\en_US\Company`
catchPhrase // 'Monitored regional contingency'
bs // 'e-enable robust architectures'
company // 'Bogan-Treutel'
companySuffix // 'and Sons'
jobTitle // 'Cashier'
### `Fa
没有合适的资源?快使用搜索试试~ 我知道了~
修复版ThinkPHP云淘客自动抢单源码/支持京东/淘宝/唯品会+APP客户端
共2000个文件
php:890个
png:278个
dat:237个
需积分: 13 6 下载量 7 浏览量
2021-03-16
20:52:49
上传
评论 1
收藏 36.02MB ZIP 举报
温馨提示
搭建环境:PHP7.0+MYSQL5.6 1、源码上传到服务器根目录 2、导入数据库,修改配置文件\config\database.php 3、短信配置文件\config\app.php,30行左右设置短信,短信接入的是短信宝,自己去申请; 4、设置 public 为运行目录; 5、设置TP伪静态; 6、后台管理:/admin 用户:admin 密码:admin888 7、前台测试ID:18100000000 密码:18100000000
资源详情
资源评论
资源推荐
收起资源包目录
修复版ThinkPHP云淘客自动抢单源码/支持京东/淘宝/唯品会+APP客户端 (2000个子文件)
app.apk 2.53MB
app.apk 2.53MB
使用教程.bat 31B
test.bmp 0B
layui.css 71KB
editor_ie8.css 49KB
editor_iequirks.css 48KB
editor_ie.css 48KB
editor_gecko.css 47KB
editor.css 47KB
hui.css 45KB
admin.css 38KB
userstyle.css 36KB
main.css 31KB
fonts.css 30KB
index_style.css 30KB
font-awesome.min.css 26KB
console.css 25KB
jquery-ui-1.10.3.custom.css 25KB
user.css 25KB
swiper.min.css 19KB
base.css 17KB
dialog_ie8.css 15KB
dialog_iequirks.css 14KB
dialog_ie.css 14KB
layer.css 14KB
dialog.css 13KB
framework.css 10KB
layui.mobile.css 10KB
bootstrap.css 10KB
funding.css 9KB
console.custom.css 9KB
laydate.css 7KB
style2.css 7KB
reg.css 7KB
mobile.css 6KB
zTreeStyle.css 6KB
widget-mobile.css 6KB
fonts.css 6KB
michat.css 5KB
layer.css 5KB
jquery.mCustomScrollbar.css 5KB
login.css 5KB
console.layout.css 4KB
bootstrap-popover.css 4KB
console.form.css 3KB
colorpicker.css 3KB
contents.css 3KB
phone.css 3KB
console.layui.css 2KB
style.css 2KB
index.css 2KB
templates.css 2KB
copyformatting.css 1KB
autocompleter.css 1KB
wsc.css 1KB
toolbar.css 1KB
wsc.css 1KB
ui.css 1KB
supersized.css 1KB
tableselection.css 1KB
code.css 1KB
colordialog.css 792B
dialog.css 419B
scayt.css 381B
qrv40_2.dat 87KB
qrv40_3.dat 87KB
qrv40_0.dat 87KB
qrv40_1.dat 87KB
qrv39_2.dat 83KB
qrv39_3.dat 83KB
qrv39_0.dat 83KB
qrv39_1.dat 83KB
qrv38_2.dat 79KB
qrv38_3.dat 79KB
qrv38_0.dat 79KB
qrv38_1.dat 79KB
qrv37_2.dat 75KB
qrv37_3.dat 75KB
qrv37_0.dat 75KB
qrv37_1.dat 75KB
qrv36_2.dat 71KB
qrv36_3.dat 71KB
qrv36_0.dat 71KB
qrv36_1.dat 71KB
qrv35_2.dat 67KB
qrv35_3.dat 67KB
qrv35_0.dat 67KB
qrv35_1.dat 67KB
qrv34_2.dat 65KB
qrv34_3.dat 65KB
qrv34_0.dat 65KB
qrv34_1.dat 65KB
qrv33_2.dat 61KB
qrv33_3.dat 61KB
qrv33_0.dat 61KB
qrv33_1.dat 61KB
qrv32_2.dat 58KB
qrv32_3.dat 58KB
qrv32_0.dat 58KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
pengyibei
- 粉丝: 14
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 自定义车位数及等候区停车场管理系统C语言源码
- MCGS昆仑通态液位PID控制仿真视频,可以单独进行手自动控制,模拟现场设备运行情况,模拟液位、温度、压力
- Qt 基于QAbstractTableModel自定义TableModel
- CITI考试资料与选择题答案
- 基于永磁同步电机(pmsm)的扩展卡尔曼转速和转子位置估计,本人已将效果调制很好,可准确估计pmsm的转速和转子位置
- 卡密社区SUP系统总控源码+主站分销系统功能源码
- MMC储能,模块化多电平变器储能,MMC-PCS,MMC-BESS,储能,SOC均衡控制,蓄电池充放电控制,mmc,储能变器,
- 2025考研22408全科全年PDF(政治+英语二+数学二+408+答题卡).zip
- 两电平逆变器vsr并网simulink仿真模型 模型由逆变器?lcl滤波器?电网?负载构成,系统额定功率为50Kw,该模型可以用于光伏或风电等的并网控制部分 逆变器采用pi双闭环控制,坐标变,dq
- Cruise双电机四轮驱动模型和单电机前驱模型,分层建模,具有控制策略模型,三种联合仿真方式都可以运行,以及sp资料
- 30套2025年横版日历excel表
- 全球摩托车市场发展前景分析报告:预计至2031年年复合增长率(CAGR)为1.4%(2025-2031)
- 三段式电流保护仿真 Simulink仿真
- 基于java的财务管理系统设计与实现.docx
- 基于java的藏区特产销售平台设计与实现.docx
- 基于java的毕业生信息招聘平台设计与实现.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0