# 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)
- [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) // 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'
### `Faker\Provider\en_US\Text`
realText($maxNbChars = 200,
没有合适的资源?快使用搜索试试~ 我知道了~
Yii 2.0.9 basic
5星 · 超过95%的资源 需积分: 11 7 下载量 141 浏览量
2016-07-12
17:10:07
上传
评论
收藏 4.93MB TGZ 举报
温馨提示
共2000个文件
php:1659个
js:202个
txt:134个
Yii官方的2.0.9最新版。 不知怎么搞的亚马逊服务器总是下载失败,我下载了十几次才成功,现在传上来方便大家。 无任何更改,请验证md5。
资源推荐
资源详情
资源评论
收起资源包目录
Yii 2.0.9 basic (2000个子文件)
yii.bat 515B
yii.bat 515B
yii.bat 515B
.bowerrc 37B
Changelog 939B
CHANGES 7KB
ci 428B
CREDITS 341B
ca.crt 1KB
sign2.crt 1KB
encrypt2.crt 1KB
sign.crt 1KB
encrypt.crt 1KB
intermediate.crt 1KB
bootstrap.css 144KB
bootstrap.min.css 120KB
bootstrap-theme.css 26KB
bootstrap-theme.min.css 23KB
toolbar.css 7KB
main.css 5KB
main.css 2KB
styles.css 2KB
site.css 1KB
ConfigForm.css 301B
smoke.conf.php.default 2KB
acceptance.conf.php.default 1KB
phpunit.xml.dist 1KB
phpunit.xml.dist 697B
phpunit.xml.dist 265B
.editorconfig 208B
glyphicons-halflings-regular.eot 20KB
glyphicons-halflings-regular.eot 20KB
.eslintrc 852B
.gitattributes 695B
.gitattributes 157B
.gitignore 366B
.gitignore 207B
.gitignore 141B
.gitignore 125B
.gitignore 123B
.gitignore 67B
.gitignore 42B
.gitignore 27B
.gitignore 27B
.gitignore 23B
.gitignore 21B
.gitignore 14B
.gitignore 13B
.gitignore 13B
.gitignore 13B
.gitignore 13B
.gitignore 1B
.gitkeep 0B
.gitkeep 0B
.gitkeep 0B
Mime.graffle 5KB
Encoders.graffle 3KB
Transports.graffle 3KB
.htaccess 14B
specs.html 31KB
md1_markdown_documentation_basics.html 9KB
playground.html 8KB
github-sample.html 4KB
tables.html 3KB
test.html 3KB
tables.html 2KB
unicode.html 2KB
url.html 2KB
md1_ordered_and_unordered_lists.html 2KB
nested-lists.html 1KB
links.html 1KB
images.html 1KB
md1_backslash_escapes.html 1KB
md1_ordered_and_unordered_lists.html 961B
lazy-list.html 851B
emphasis.html 838B
dense-block-markers.html 791B
endless_loop_bug.html 780B
dense-block-markers.html 773B
md1_inline_html_simple.html 725B
references.html 656B
special-attributes.html 631B
github-basics.html 595B
list_items_with_undefined_ref.html 590B
list.html 569B
md1_auto_links.html 538B
dense-block-markers2.html 491B
md1_amps_and_angle_encoding.html 432B
md1_tabs.html 427B
html-block.html 422B
md1_horizontal_rules.html 401B
issue-38.html 400B
md1_links_reference_style.html 399B
escape-in-link.html 380B
list.html 357B
headline.html 348B
code.html 305B
inline-html.html 297B
blockquote-nested.html 296B
md1_links_inline_style.html 277B
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
- m00nb0y2016-07-17准备应用。从别处都下载不成功,幸好这里有。推荐国内用户都来下载使用。谢谢大侠的分享!
haha7day
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- VoNR应答掉话率分析处理案例.docx
- 基于matlab实现数字图像相关,该程序试图通过比较变形前和变形后的两张图像来计算应力和应变GUI.rar
- 基于matlab实现数字基带传输系统的matlab仿真源码及附属文件.rar
- 基于matlab实现生成高斯散斑图.rar
- ZBlog 宁静致远主题压缩包
- 基于matlab实现水声通信仿真代码,包括时间反转镜均衡,各种调制解调,信道仿真扥等.rar
- 基于matlab实现水声通信中的psk方法,信道为多径信道,接收段进行均衡处理,是较为完整的psk水声通信系统仿真.rar
- 基于matlab实现水声信道传输特性进行仿真的程序,包括水声信道特性对时反镜稳健性能影响等仿真程序 .rar
- 基于matlab实现水声信道仿真程序 用于水下声信道的仿真 .rar
- GEE训练-如何确定影像数据集多个指定时间范围的影像数量(sentinel-1数据为例)含全部代码.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功