# Faker
[![Code Coverage](https://codecov.io/gh/fzaninotto/Faker/branch/master/graph/badge.svg)](https://codecov.io/gh/fzaninotto/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
### Autoloading
Faker supports both `PSR-0` as `PSR-4` autoloaders.
```php
<?php
# When installed via composer
require_once 'vendor/autoload.php';
```
You can also load `Fakers` shipped `PSR-0` autoloader
```php
<?php
# Load Fakers own autoloader
require_once '/path/to/Faker/src/autoload.php';
```
*alternatively, you can use any another PSR-4 compliant autoloader*
### Create fake data
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
// 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
randomDigitNot(5) // 0, 1, 2, 3, 4, 6, 7, 8, or 9
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-026
没有合适的资源?快使用搜索试试~ 我知道了~
PHP音乐社交平台MusicEv2.1.6.2源码下载
共2000个文件
php:500个
md:439个
js:287个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 189 浏览量
2024-07-22
14:44:17
上传
评论
收藏 61.46MB ZIP 举报
温馨提示
PHP音乐社交平台:MusicEv2.1.6.2源码下载。这是一套国外程序,限量买不到,这玩意虽然平时用不着,但是万一有用得着的时候呢!MusicEngine 是一个专门为音乐家服务的社交网站。 这是一个独特的概念,将社交网络和音乐共享的力量集中在一个地方。 基于laravel框架编写。 功能简介 支持所有浏览,甚至Internet Explore 11; 无刷新播放歌曲; 具有现代设计的明暗主题,即使在移动设备上也超快 对移动设备的认真设计和呵护; 易于更改 url 结构 支持 Wasabi、Amazone S3、FTP、Cloud Driver 来存储您的媒体。 支持 HLS 以保护您的音乐文件,这也有助于在 iOS 设备上更快地播放 支持存储高清版音乐文件(例如订阅播放) 支持 Laravel 队列发送电子邮件和创建艺术品转换。 根据需要通过电子邮件或用户名登录 已授予权限的用户组级别,易于创建 Admin 或 Modration 帐户。 使用 Widget Embed player 分享歌曲/专辑/播放列表/队列当前歌曲 将音乐对象拖放到队列中 支持多存
资源推荐
资源详情
资源评论
收起资源包目录
PHP音乐社交平台MusicEv2.1.6.2源码下载 (2000个子文件)
app.css 393KB
style_dark.css 304KB
style.css 283KB
bootstrap.min.css 152KB
bootstrap.css 137KB
styles-1.css 130KB
all.css 68KB
fontawesome.css 67KB
embed.css 67KB
skin.min.css 55KB
all.min.css 55KB
skin.min.css 55KB
fontawesome.min.css 54KB
jquery-ui.min.css 51KB
beats.css 45KB
v4-shims.css 40KB
jsoneditor.css 40KB
theme.css 38KB
jsoneditor.min.css 33KB
cart.css 32KB
v4-shims.min.css 26KB
swiper.css 22KB
styles-2.css 21KB
skin.mobile.min.css 21KB
skin.mobile.min.css 21KB
_all.css 20KB
select2.css 19KB
comments.css 18KB
content.min.css 18KB
content.inline.min.css 18KB
content.inline.min.css 18KB
content.min.css 17KB
select2.css 17KB
file.css 17KB
custom.css 16KB
jquery-contextmenu.css 16KB
jquery.datetimepicker.min.css 16KB
select2.min.css 15KB
_all.css 14KB
_all.css 14KB
exception.css 14KB
jquery.dataTables.min.css 14KB
_all.css 12KB
whoops.base.css 12KB
fileinput.css 11KB
jqueryui.css 10KB
panel.css 9KB
nv.d3.min.css 9KB
fileinput.min.css 9KB
stylesheet.css 8KB
svg-with-js.css 8KB
svg-with-js.min.css 6KB
loading.css 6KB
dataTables.bootstrap4.min.css 5KB
jquery-nestable.css 5KB
default.css 4KB
theme.css 4KB
theme.css 4KB
theme.css 4KB
main.css 4KB
reaction.css 3KB
theme.min.css 3KB
theme.min.css 3KB
theme.min.css 3KB
htmlDescriptor.css 3KB
exception_full.css 3KB
getid3.css 2KB
purple.css 2KB
yellow.css 2KB
orange.css 2KB
green.css 2KB
grey.css 2KB
aero.css 2KB
pink.css 2KB
blue.css 2KB
red.css 2KB
fileinput-rtl.css 2KB
line.css 2KB
style.css 2KB
custom.css 2KB
fileinput-rtl.min.css 2KB
all.css 2KB
purple.css 2KB
orange.css 2KB
yellow.css 2KB
purple.css 2KB
orange.css 2KB
yellow.css 2KB
green.css 2KB
green.css 1KB
blue.css 1KB
pink.css 1KB
aero.css 1KB
grey.css 1KB
blue.css 1KB
grey.css 1KB
aero.css 1KB
pink.css 1KB
red.css 1KB
red.css 1KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
破碎的天堂鸟
- 粉丝: 8714
- 资源: 2390
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功