HumHub Documentation (unofficial)

Generator
in package

Table of Contents

Properties

$address  : string
$amPm  : string
$asciify  : string
$biasedNumberBetween  : int
$boolean  : bool
$bothify  : string
$buildingNumber  : string
$century  : string
$chrome  : string
$city  : string
$citySuffix  : string
$colorName  : string
$company  : string
$companyEmail  : string
$companySuffix  : string
$country  : string
$countryCode  : string
$countryISOAlpha3  : string
$creditCardDetails  : array<string|int, mixed>
$creditCardExpirationDate  : DateTime
$creditCardExpirationDateString  : string
$creditCardNumber  : string
$creditCardType  : string
$currencyCode  : string
$date  : string
$dateTime  : DateTime
$dateTimeAD  : DateTime
$dateTimeBetween  : DateTime
$dateTimeInInterval  : DateTime
$dateTimeThisCentury  : DateTime
$dateTimeThisDecade  : DateTime
$dateTimeThisMonth  : DateTime
$dateTimeThisYear  : DateTime
$dayOfMonth  : string
$dayOfWeek  : string
$domainName  : string
$domainWord  : string
$e164PhoneNumber  : string
$email  : string
$emoji  : string
$file  : string
$firefox  : string
$firstName  : string
$firstNameFemale  : string
$firstNameMale  : string
$freeEmail  : string
$freeEmailDomain  : string
$getDefaultTimezone  : string
$hexColor  : string
$hslColor  : string
$hslColorAsArray  : array<string|int, mixed>
$iban  : string
$image  : string
$imageUrl  : string
$imei  : int
$internetExplorer  : string
$iosMobileToken  : string
$ipv4  : string
$ipv6  : string
$iso8601  : string
$jobTitle  : string
$languageCode  : string
$lastName  : string
$latitude  : float
$lexify  : string
$linuxPlatformToken  : string
$linuxProcessor  : string
$localCoordinates  : array<string|int, float>
$locale  : string
$localIpv4  : string
$longitude  : float
$macAddress  : string
$macPlatformToken  : string
$macProcessor  : string
$md5  : string
$month  : string
$monthName  : string
$msedge  : string
$name  : string
$numerify  : string
$opera  : string
$paragraph  : string
$paragraphs  : array<string|int, mixed>|string
$passthrough  : mixed
$password  : string
$phoneNumber  : string
$postcode  : string
$randomAscii  : string
$randomDigitNotNull  : int
$randomElement  : mixed
$randomElements  : array<string|int, mixed>
$randomHtml  : string
$randomKey  : int|string|null
$randomLetter  : string
$realText  : string
$realTextBetween  : string
$regexify  : string
$rgbaCssColor  : string
$rgbColor  : string
$rgbColorAsArray  : array<string|int, mixed>
$rgbCssColor  : string
$safari  : string
$safeColorName  : string
$safeEmail  : string
$safeEmailDomain  : string
$safeHexColor  : string
$sentence  : string
$sentences  : array<string|int, mixed>|string
$setDefaultTimezone  : void
$sha1  : string
$sha256  : string
$shuffle  : array<string|int, mixed>|string
$shuffleArray  : array<string|int, mixed>
$shuffleString  : string
$slug  : string
$streetAddress  : string
$streetName  : string
$streetSuffix  : string
$swiftBicNumber  : string
$text  : string
$time  : string
$timezone  : string
$title  : string
$titleFemale  : string
$titleMale  : string
$tld  : string
$toLower  : string
$toUpper  : string
$unixTime  : int
$url  : string
$userAgent  : string
$userName  : string
$uuid  : string
$windowsPlatformToken  : string
$word  : string
$words  : array<string|int, mixed>|string
$year  : string
$formatters  : mixed
$providers  : mixed
$container  : mixed
$uniqueGenerator  : UniqueGenerator

Methods

__call()  : mixed
__construct()  : mixed
__destruct()  : mixed
__get()  : mixed
__wakeup()  : mixed
addProvider()  : mixed
address()  : string
amPm()  : string
asciify()  : string
biasedNumberBetween()  : int
bloodGroup()  : string
Get a full blood group
bloodRh()  : string
Get a random resis value
bloodType()  : string
Get an actual blood type
boolean()  : bool
bothify()  : string
buildingNumber()  : string
century()  : string
chrome()  : string
city()  : string
citySuffix()  : string
colorName()  : string
company()  : string
companyEmail()  : string
companySuffix()  : string
country()  : string
countryCode()  : string
countryISOAlpha3()  : string
creditCardDetails()  : array<string|int, mixed>
creditCardExpirationDate()  : DateTime
creditCardExpirationDateString()  : string
creditCardNumber()  : string
creditCardType()  : string
currencyCode()  : string
date()  : string
dateTime()  : DateTime
dateTimeAD()  : DateTime
dateTimeBetween()  : DateTime
dateTimeInInterval()  : DateTime
dateTimeThisCentury()  : DateTime
dateTimeThisDecade()  : DateTime
dateTimeThisMonth()  : DateTime
dateTimeThisYear()  : DateTime
dayOfMonth()  : string
dayOfWeek()  : string
domainName()  : string
domainWord()  : string
e164PhoneNumber()  : string
ean13()  : string
Get a random EAN13 barcode.
ean8()  : string
Get a random EAN8 barcode.
email()  : string
emoji()  : string
ext()  : T
file()  : string
fileExtension()  : mixed
Get a random file extension (without a dot)
filePath()  : mixed
Get a full path to a new real file on the system.
firefox()  : string
firstName()  : string
firstNameFemale()  : string
firstNameMale()  : string
format()  : mixed
freeEmail()  : string
freeEmailDomain()  : string
getDefaultTimezone()  : string
getFormatter()  : callable
getProviders()  : mixed
hexColor()  : string
hslColor()  : string
hslColorAsArray()  : array<string|int, mixed>
iban()  : string
image()  : string
imageUrl()  : string
imei()  : int
internetExplorer()  : string
iosMobileToken()  : string
ipv4()  : string
ipv6()  : string
isbn10()  : string
Get a random ISBN-10 code
isbn13()  : string
Get a random ISBN-13 code
iso8601()  : string
jobTitle()  : string
languageCode()  : string
lastName()  : string
latitude()  : float
lexify()  : string
linuxPlatformToken()  : string
linuxProcessor()  : string
localCoordinates()  : array<string|int, float>
locale()  : string
localIpv4()  : string
longitude()  : float
macAddress()  : string
macPlatformToken()  : string
macProcessor()  : string
md5()  : string
mimeType()  : mixed
Get a random MIME type
month()  : string
monthName()  : string
msedge()  : string
name()  : string
numberBetween()  : int
Returns a random number between $int1 and $int2 (any order)
numerify()  : string
opera()  : string
optional()  : self
Get a value only some percentage of the time.
paragraph()  : string
paragraphs()  : array<string|int, mixed>|string
parse()  : string
Replaces tokens ('{{ tokenName }}') with the result from the token method call
passthrough()  : mixed
password()  : string
phoneNumber()  : string
postcode()  : string
randomAscii()  : string
randomDigit()  : int
Returns a random number between 0 and 9
randomDigitNot()  : int
Generates a random digit, which cannot be $except
randomDigitNotNull()  : int
randomDigitNotZero()  : int
Returns a random number between 1 and 9
randomElement()  : mixed
randomElements()  : array<string|int, mixed>
randomFloat()  : float
Return a random float number
randomHtml()  : string
randomKey()  : int|string|null
randomLetter()  : string
randomNumber()  : int
Returns a random integer with 0 to $nbDigits digits.
realText()  : string
realTextBetween()  : string
regexify()  : string
rgbaCssColor()  : string
rgbColor()  : string
rgbColorAsArray()  : array<string|int, mixed>
rgbCssColor()  : string
safari()  : string
safeColorName()  : string
safeEmail()  : string
safeEmailDomain()  : string
safeHexColor()  : string
seed()  : mixed
semver()  : string
Get a version number in semantic versioning syntax 2.0.0. (https://semver.org/spec/v2.0.0.html)
sentence()  : string
sentences()  : array<string|int, mixed>|string
setDefaultTimezone()  : void
sha1()  : string
sha256()  : string
shuffle()  : array<string|int, mixed>|string
shuffleArray()  : array<string|int, mixed>
shuffleString()  : string
slug()  : string
streetAddress()  : string
streetName()  : string
streetSuffix()  : string
swiftBicNumber()  : string
text()  : string
time()  : string
timezone()  : string
title()  : string
titleFemale()  : string
titleMale()  : string
tld()  : string
toLower()  : string
toUpper()  : string
unique()  : self
With the unique generator you are guaranteed to never get the same two values.
unixTime()  : int
url()  : string
userAgent()  : string
userName()  : string
uuid()  : string
valid()  : self
To make sure the value meet some criteria, pass a callable that verifies the output. If the validator fails, the generator will try again.
windowsPlatformToken()  : string
word()  : string
words()  : array<string|int, mixed>|string
year()  : string
callFormatWithMatches()  : mixed
mode()  : int

Properties

$biasedNumberBetween

public int $biasedNumberBetween

$buildingNumber

public string $buildingNumber

$countryISOAlpha3

public string $countryISOAlpha3

$creditCardDetails

public array<string|int, mixed> $creditCardDetails

$creditCardExpirationDate

public DateTime $creditCardExpirationDate

$creditCardExpirationDateString

public string $creditCardExpirationDateString

$creditCardNumber

public string $creditCardNumber

$creditCardType

public string $creditCardType

$dateTimeBetween

public DateTime $dateTimeBetween

$dateTimeInInterval

public DateTime $dateTimeInInterval

$dateTimeThisCentury

public DateTime $dateTimeThisCentury

$dateTimeThisDecade

public DateTime $dateTimeThisDecade

$dateTimeThisMonth

public DateTime $dateTimeThisMonth

$dateTimeThisYear

public DateTime $dateTimeThisYear

$e164PhoneNumber

public string $e164PhoneNumber

$firstNameFemale

public string $firstNameFemale

$freeEmailDomain

public string $freeEmailDomain

$getDefaultTimezone

public string $getDefaultTimezone

$hslColorAsArray

public array<string|int, mixed> $hslColorAsArray

$internetExplorer

public string $internetExplorer

$iosMobileToken

public string $iosMobileToken

$linuxPlatformToken

public string $linuxPlatformToken

$linuxProcessor

public string $linuxProcessor

$localCoordinates

public array<string|int, float> $localCoordinates

$macPlatformToken

public string $macPlatformToken

$paragraphs

public array<string|int, mixed>|string $paragraphs

$randomDigitNotNull

public int $randomDigitNotNull

$randomElements

public array<string|int, mixed> $randomElements

$realTextBetween

public string $realTextBetween

$rgbColorAsArray

public array<string|int, mixed> $rgbColorAsArray

$safeEmailDomain

public string $safeEmailDomain

$sentences

public array<string|int, mixed>|string $sentences

$setDefaultTimezone

public void $setDefaultTimezone

$shuffle

public array<string|int, mixed>|string $shuffle

$shuffleArray

public array<string|int, mixed> $shuffleArray

$swiftBicNumber

public string $swiftBicNumber

$windowsPlatformToken

public string $windowsPlatformToken

$words

public array<string|int, mixed>|string $words

$formatters

protected mixed $formatters = []

Methods

__call()

public __call(string $method, array<string|int, mixed> $attributes) : mixed
Parameters
$method : string
$attributes : array<string|int, mixed>

__get()

public __get(string $attribute) : mixed
Parameters
$attribute : string
Tags
deprecated

Use a method instead.

addProvider()

public addProvider(mixed $provider) : mixed
Parameters
$provider : mixed

address()

public address() : string
Return values
string

amPm()

public amPm([mixed $max = '\'now\'' ]) : string
Parameters
$max : mixed = '\'now\''
Return values
string

asciify()

public asciify([mixed $string = '\'****\'' ]) : string
Parameters
$string : mixed = '\'****\''
Return values
string

biasedNumberBetween()

public biasedNumberBetween([mixed $min = 0 ][, mixed $max = 100 ][, mixed $function = '\'sqrt\'' ]) : int
Parameters
$min : mixed = 0
$max : mixed = 100
$function : mixed = '\'sqrt\''
Return values
int

bloodGroup()

Get a full blood group

public bloodGroup() : string
Tags
example

'AB+'

Return values
string

bloodRh()

Get a random resis value

public bloodRh() : string
Tags
example

'+'

Return values
string

bloodType()

Get an actual blood type

public bloodType() : string
Tags
example

'AB'

Return values
string

boolean()

public boolean([mixed $chanceOfGettingTrue = 50 ]) : bool
Parameters
$chanceOfGettingTrue : mixed = 50
Return values
bool

bothify()

public bothify([mixed $string = '\'## ??\'' ]) : string
Parameters
$string : mixed = '\'## ??\''
Return values
string

buildingNumber()

public buildingNumber() : string
Return values
string

century()

public century() : string
Return values
string

chrome()

public chrome() : string
Return values
string

city()

public city() : string
Return values
string

citySuffix()

public citySuffix() : string
Return values
string

colorName()

public colorName() : string
Return values
string

company()

public company() : string
Return values
string

companyEmail()

public companyEmail() : string
Return values
string

companySuffix()

public companySuffix() : string
Return values
string

country()

public country() : string
Return values
string

countryCode()

public countryCode() : string
Return values
string

countryISOAlpha3()

public countryISOAlpha3() : string
Return values
string

creditCardDetails()

public creditCardDetails([mixed $valid = true ]) : array<string|int, mixed>
Parameters
$valid : mixed = true
Return values
array<string|int, mixed>

creditCardExpirationDate()

public creditCardExpirationDate([mixed $valid = true ]) : DateTime
Parameters
$valid : mixed = true
Return values
DateTime

creditCardExpirationDateString()

public creditCardExpirationDateString([mixed $valid = true ][, mixed $expirationDateFormat = null ]) : string
Parameters
$valid : mixed = true
$expirationDateFormat : mixed = null
Return values
string

creditCardNumber()

public creditCardNumber([mixed $type = null ][, mixed $formatted = false ][, mixed $separator = '\'-\'' ]) : string
Parameters
$type : mixed = null
$formatted : mixed = false
$separator : mixed = '\'-\''
Return values
string

creditCardType()

public creditCardType() : string
Return values
string

currencyCode()

public currencyCode() : string
Return values
string

date()

public date([mixed $format = '\'Y-m-d\'' ][, mixed $max = '\'now\'' ]) : string
Parameters
$format : mixed = '\'Y-m-d\''
$max : mixed = '\'now\''
Return values
string

dateTime()

public dateTime([mixed $max = '\'now\'' ][, mixed $timezone = null ]) : DateTime
Parameters
$max : mixed = '\'now\''
$timezone : mixed = null
Return values
DateTime

dateTimeAD()

public dateTimeAD([mixed $max = '\'now\'' ][, mixed $timezone = null ]) : DateTime
Parameters
$max : mixed = '\'now\''
$timezone : mixed = null
Return values
DateTime

dateTimeBetween()

public dateTimeBetween([mixed $startDate = '\'-30 years\'' ][, mixed $endDate = '\'now\'' ][, mixed $timezone = null ]) : DateTime
Parameters
$startDate : mixed = '\'-30 years\''
$endDate : mixed = '\'now\''
$timezone : mixed = null
Return values
DateTime

dateTimeInInterval()

public dateTimeInInterval([mixed $date = '\'-30 years\'' ][, mixed $interval = '\'+5 days\'' ][, mixed $timezone = null ]) : DateTime
Parameters
$date : mixed = '\'-30 years\''
$interval : mixed = '\'+5 days\''
$timezone : mixed = null
Return values
DateTime

dateTimeThisCentury()

public dateTimeThisCentury([mixed $max = '\'now\'' ][, mixed $timezone = null ]) : DateTime
Parameters
$max : mixed = '\'now\''
$timezone : mixed = null
Return values
DateTime

dateTimeThisDecade()

public dateTimeThisDecade([mixed $max = '\'now\'' ][, mixed $timezone = null ]) : DateTime
Parameters
$max : mixed = '\'now\''
$timezone : mixed = null
Return values
DateTime

dateTimeThisMonth()

public dateTimeThisMonth([mixed $max = '\'now\'' ][, mixed $timezone = null ]) : DateTime
Parameters
$max : mixed = '\'now\''
$timezone : mixed = null
Return values
DateTime

dateTimeThisYear()

public dateTimeThisYear([mixed $max = '\'now\'' ][, mixed $timezone = null ]) : DateTime
Parameters
$max : mixed = '\'now\''
$timezone : mixed = null
Return values
DateTime

dayOfMonth()

public dayOfMonth([mixed $max = '\'now\'' ]) : string
Parameters
$max : mixed = '\'now\''
Return values
string

dayOfWeek()

public dayOfWeek([mixed $max = '\'now\'' ]) : string
Parameters
$max : mixed = '\'now\''
Return values
string

domainName()

public domainName() : string
Return values
string

domainWord()

public domainWord() : string
Return values
string

e164PhoneNumber()

public e164PhoneNumber() : string
Return values
string

ean13()

Get a random EAN13 barcode.

public ean13() : string
Tags
example

'4006381333931'

Return values
string

ean8()

Get a random EAN8 barcode.

public ean8() : string
Tags
example

'73513537'

Return values
string

email()

public email() : string
Return values
string

emoji()

public emoji() : string
Return values
string

ext()

public ext(T> $id) : T
Parameters
$id : T>
Tags
template

T of Extension\Extension

throws
ExtensionNotFound
Return values
T

file()

public file([mixed $sourceDirectory = '\'/tmp\'' ][, mixed $targetDirectory = '\'/tmp\'' ][, mixed $fullPath = true ]) : string
Parameters
$sourceDirectory : mixed = '\'/tmp\''
$targetDirectory : mixed = '\'/tmp\''
$fullPath : mixed = true
Return values
string

fileExtension()

Get a random file extension (without a dot)

public fileExtension() : mixed
Tags
example

avi

filePath()

Get a full path to a new real file on the system.

public filePath() : mixed

firefox()

public firefox() : string
Return values
string

firstName()

public firstName([mixed $gender = null ]) : string
Parameters
$gender : mixed = null
Return values
string

firstNameFemale()

public firstNameFemale() : string
Return values
string

firstNameMale()

public firstNameMale() : string
Return values
string

format()

public format(mixed $format[, mixed $arguments = [] ]) : mixed
Parameters
$format : mixed
$arguments : mixed = []

freeEmail()

public freeEmail() : string
Return values
string

freeEmailDomain()

public freeEmailDomain() : string
Return values
string

getDefaultTimezone()

public getDefaultTimezone() : string
Return values
string

getFormatter()

public getFormatter(string $format) : callable
Parameters
$format : string
Return values
callable

getProviders()

public getProviders() : mixed

hexColor()

public hexColor() : string
Return values
string

hslColor()

public hslColor() : string
Return values
string

hslColorAsArray()

public hslColorAsArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

iban()

public iban([mixed $countryCode = null ][, mixed $prefix = '\'\'' ][, mixed $length = null ]) : string
Parameters
$countryCode : mixed = null
$prefix : mixed = '\'\''
$length : mixed = null
Return values
string

image()

public image([mixed $dir = null ][, mixed $width = 640 ][, mixed $height = 480 ][, mixed $category = null ][, mixed $fullPath = true ][, mixed $randomize = true ][, mixed $word = null ][, mixed $gray = false ][, string $format = '\'png\'' ]) : string
Parameters
$dir : mixed = null
$width : mixed = 640
$height : mixed = 480
$category : mixed = null
$fullPath : mixed = true
$randomize : mixed = true
$word : mixed = null
$gray : mixed = false
$format : string = '\'png\''
Return values
string

imageUrl()

public imageUrl([mixed $width = 640 ][, mixed $height = 480 ][, mixed $category = null ][, mixed $randomize = true ][, mixed $word = null ][, mixed $gray = false ][, string $format = '\'png\'' ]) : string
Parameters
$width : mixed = 640
$height : mixed = 480
$category : mixed = null
$randomize : mixed = true
$word : mixed = null
$gray : mixed = false
$format : string = '\'png\''
Return values
string

internetExplorer()

public internetExplorer() : string
Return values
string

iosMobileToken()

public iosMobileToken() : string
Return values
string

ipv4()

public ipv4() : string
Return values
string

ipv6()

public ipv6() : string
Return values
string

iso8601()

public iso8601([mixed $max = '\'now\'' ]) : string
Parameters
$max : mixed = '\'now\''
Return values
string

jobTitle()

public jobTitle() : string
Return values
string

languageCode()

public languageCode() : string
Return values
string

lastName()

public lastName([mixed $gender = null ]) : string
Parameters
$gender : mixed = null
Return values
string

latitude()

public latitude([mixed $min = -90 ][, mixed $max = 90 ]) : float
Parameters
$min : mixed = -90
$max : mixed = 90
Return values
float

lexify()

public lexify([mixed $string = '\'????\'' ]) : string
Parameters
$string : mixed = '\'????\''
Return values
string

linuxPlatformToken()

public linuxPlatformToken() : string
Return values
string

linuxProcessor()

public linuxProcessor() : string
Return values
string

localCoordinates()

public localCoordinates() : array<string|int, float>
Return values
array<string|int, float>

locale()

public locale() : string
Return values
string

localIpv4()

public localIpv4() : string
Return values
string

longitude()

public longitude([mixed $min = -180 ][, mixed $max = 180 ]) : float
Parameters
$min : mixed = -180
$max : mixed = 180
Return values
float

macAddress()

public macAddress() : string
Return values
string

macPlatformToken()

public macPlatformToken() : string
Return values
string

macProcessor()

public macProcessor() : string
Return values
string

md5()

public md5() : string
Return values
string

mimeType()

Get a random MIME type

public mimeType() : mixed
Tags
example

'video/avi'

month()

public month([mixed $max = '\'now\'' ]) : string
Parameters
$max : mixed = '\'now\''
Return values
string

monthName()

public monthName([mixed $max = '\'now\'' ]) : string
Parameters
$max : mixed = '\'now\''
Return values
string

msedge()

public msedge() : string
Return values
string

name()

public name([mixed $gender = null ]) : string
Parameters
$gender : mixed = null
Return values
string

numberBetween()

Returns a random number between $int1 and $int2 (any order)

public numberBetween([mixed $int1 = 0 ][, mixed $int2 = 2147483647 ]) : int
Parameters
$int1 : mixed = 0
$int2 : mixed = 2147483647
Tags
example

79907610

Return values
int

numerify()

public numerify([mixed $string = '\'###\'' ]) : string
Parameters
$string : mixed = '\'###\''
Return values
string

opera()

public opera() : string
Return values
string

optional()

Get a value only some percentage of the time.

public optional([float $weight = 0.5 ][, mixed $default = null ]) : self
Parameters
$weight : float = 0.5

A probability between 0 and 1, 0 means that we always get the default value.

$default : mixed = null
Return values
self

paragraph()

public paragraph([mixed $nbSentences = 3 ][, mixed $variableNbSentences = true ]) : string
Parameters
$nbSentences : mixed = 3
$variableNbSentences : mixed = true
Return values
string

paragraphs()

public paragraphs([mixed $nb = 3 ][, mixed $asText = false ]) : array<string|int, mixed>|string
Parameters
$nb : mixed = 3
$asText : mixed = false
Return values
array<string|int, mixed>|string

parse()

Replaces tokens ('{{ tokenName }}') with the result from the token method call

public parse(string $string) : string
Parameters
$string : string

String that needs to bet parsed

Return values
string

passthrough()

public passthrough([mixed $value = ]) : mixed
Parameters
$value : mixed =

password()

public password([mixed $minLength = 6 ][, mixed $maxLength = 20 ]) : string
Parameters
$minLength : mixed = 6
$maxLength : mixed = 20
Return values
string

phoneNumber()

public phoneNumber() : string
Return values
string

postcode()

public postcode() : string
Return values
string

randomAscii()

public randomAscii() : string
Return values
string

randomDigit()

Returns a random number between 0 and 9

public randomDigit() : int
Return values
int

randomDigitNot()

Generates a random digit, which cannot be $except

public randomDigitNot(mixed $except) : int
Parameters
$except : mixed
Return values
int

randomDigitNotNull()

public randomDigitNotNull() : int
Return values
int

randomDigitNotZero()

Returns a random number between 1 and 9

public randomDigitNotZero() : int
Return values
int

randomElement()

public randomElement([mixed $array = ['\'a\'', '\'b\'', '\'c\''] ]) : mixed
Parameters
$array : mixed = ['\'a\'', '\'b\'', '\'c\'']

randomElements()

public randomElements([mixed $array = ['\'a\'', '\'b\'', '\'c\''] ][, mixed $count = 1 ][, mixed $allowDuplicates = false ]) : array<string|int, mixed>
Parameters
$array : mixed = ['\'a\'', '\'b\'', '\'c\'']
$count : mixed = 1
$allowDuplicates : mixed = false
Return values
array<string|int, mixed>

randomFloat()

Return a random float number

public randomFloat([mixed $nbMaxDecimals = null ][, mixed $min = 0 ][, mixed $max = null ]) : float
Parameters
$nbMaxDecimals : mixed = null
$min : mixed = 0
$max : mixed = null
Tags
example

48.8932

Return values
float

randomHtml()

public randomHtml([mixed $maxDepth = 4 ][, mixed $maxWidth = 4 ]) : string
Parameters
$maxDepth : mixed = 4
$maxWidth : mixed = 4
Return values
string

randomKey()

public randomKey([mixed $array = [] ]) : int|string|null
Parameters
$array : mixed = []
Return values
int|string|null

randomLetter()

public randomLetter() : string
Return values
string

randomNumber()

Returns a random integer with 0 to $nbDigits digits.

public randomNumber([int|null $nbDigits = null ][, bool $strict = false ]) : int

The maximum value returned is mt_getrandmax()

Parameters
$nbDigits : int|null = null

Defaults to a random number between 1 and 9

$strict : bool = false

Whether the returned number should have exactly $nbDigits

Tags
example

79907610

Return values
int

realText()

public realText([mixed $maxNbChars = 200 ][, mixed $indexSize = 2 ]) : string
Parameters
$maxNbChars : mixed = 200
$indexSize : mixed = 2
Return values
string

realTextBetween()

public realTextBetween([mixed $minNbChars = 160 ][, mixed $maxNbChars = 200 ][, mixed $indexSize = 2 ]) : string
Parameters
$minNbChars : mixed = 160
$maxNbChars : mixed = 200
$indexSize : mixed = 2
Return values
string

regexify()

public regexify([mixed $regex = '\'\'' ]) : string
Parameters
$regex : mixed = '\'\''
Return values
string

rgbaCssColor()

public rgbaCssColor() : string
Return values
string

rgbColor()

public rgbColor() : string
Return values
string

rgbColorAsArray()

public rgbColorAsArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

rgbCssColor()

public rgbCssColor() : string
Return values
string

safari()

public safari() : string
Return values
string

safeColorName()

public safeColorName() : string
Return values
string

safeEmail()

public safeEmail() : string
Return values
string

safeEmailDomain()

public safeEmailDomain() : string
Return values
string

safeHexColor()

public safeHexColor() : string
Return values
string

seed()

public seed([mixed $seed = null ]) : mixed
Parameters
$seed : mixed = null

semver()

Get a version number in semantic versioning syntax 2.0.0. (https://semver.org/spec/v2.0.0.html)

public semver([bool $preRelease = false ][, bool $build = false ]) : string
Parameters
$preRelease : bool = false

Pre release parts may be randomly included

$build : bool = false

Build parts may be randomly included

Tags
example

1.0.0

example

1.0.0-alpha.1

example

1.0.0-alpha.1+b71f04d

Return values
string

sentence()

public sentence([mixed $nbWords = 6 ][, mixed $variableNbWords = true ]) : string
Parameters
$nbWords : mixed = 6
$variableNbWords : mixed = true
Return values
string

sentences()

public sentences([mixed $nb = 3 ][, mixed $asText = false ]) : array<string|int, mixed>|string
Parameters
$nb : mixed = 3
$asText : mixed = false
Return values
array<string|int, mixed>|string

setDefaultTimezone()

public setDefaultTimezone([mixed $timezone = null ]) : void
Parameters
$timezone : mixed = null

sha1()

public sha1() : string
Return values
string

sha256()

public sha256() : string
Return values
string

shuffle()

public shuffle([mixed $arg = '\'\'' ]) : array<string|int, mixed>|string
Parameters
$arg : mixed = '\'\''
Return values
array<string|int, mixed>|string

shuffleArray()

public shuffleArray([mixed $array = [] ]) : array<string|int, mixed>
Parameters
$array : mixed = []
Return values
array<string|int, mixed>

shuffleString()

public shuffleString([mixed $string = '\'\'' ][, mixed $encoding = '\'UTF-8\'' ]) : string
Parameters
$string : mixed = '\'\''
$encoding : mixed = '\'UTF-8\''
Return values
string

slug()

public slug([mixed $nbWords = 6 ][, mixed $variableNbWords = true ]) : string
Parameters
$nbWords : mixed = 6
$variableNbWords : mixed = true
Return values
string

streetAddress()

public streetAddress() : string
Return values
string

streetName()

public streetName() : string
Return values
string

streetSuffix()

public streetSuffix() : string
Return values
string

swiftBicNumber()

public swiftBicNumber() : string
Return values
string

text()

public text([mixed $maxNbChars = 200 ]) : string
Parameters
$maxNbChars : mixed = 200
Return values
string

time()

public time([mixed $format = '\'H:i:s\'' ][, mixed $max = '\'now\'' ]) : string
Parameters
$format : mixed = '\'H:i:s\''
$max : mixed = '\'now\''
Return values
string

timezone()

public timezone([mixed $countryCode = null ]) : string
Parameters
$countryCode : mixed = null
Return values
string

title()

public title([mixed $gender = null ]) : string
Parameters
$gender : mixed = null
Return values
string

titleFemale()

public titleFemale() : string
Return values
string

titleMale()

public titleMale() : string
Return values
string

tld()

public tld() : string
Return values
string

toLower()

public toLower([mixed $string = '\'\'' ]) : string
Parameters
$string : mixed = '\'\''
Return values
string

toUpper()

public toUpper([mixed $string = '\'\'' ]) : string
Parameters
$string : mixed = '\'\''
Return values
string

unique()

With the unique generator you are guaranteed to never get the same two values.

public unique([bool $reset = false ][, int $maxRetries = 10000 ]) : self
// will never return twice the same value $faker->unique()->randomElement(array(1, 2, 3));
Parameters
$reset : bool = false

If set to true, resets the list of existing values

$maxRetries : int = 10000

Maximum number of retries to find a unique value, After which an OverflowException is thrown.

Tags
throws
OverflowException

When no unique value can be found by iterating $maxRetries times

Return values
self

A proxy class returning only non-existing values

unixTime()

public unixTime([mixed $max = '\'now\'' ]) : int
Parameters
$max : mixed = '\'now\''
Return values
int

url()

public url() : string
Return values
string

userAgent()

public userAgent() : string
Return values
string

userName()

public userName() : string
Return values
string

uuid()

public uuid() : string
Return values
string

valid()

To make sure the value meet some criteria, pass a callable that verifies the output. If the validator fails, the generator will try again.

public valid([Closure|null $validator = null ][, int $maxRetries = 10000 ]) : self

The value validity is determined by a function passed as first argument.

$values = array(); $evenValidator = function ($digit) { return $digit % 2 === 0; }; for ($i=0; $i < 10; $i++) { $values []= $faker->valid($evenValidator)->randomDigit; } print_r($values); // [0, 4, 8, 4, 2, 6, 0, 8, 8, 6]
Parameters
$validator : Closure|null = null

A function returning true for valid values

$maxRetries : int = 10000

Maximum number of retries to find a valid value, After which an OverflowException is thrown.

Tags
throws
OverflowException

When no valid value can be found by iterating $maxRetries times

Return values
self

A proxy class returning only valid values

windowsPlatformToken()

public windowsPlatformToken() : string
Return values
string

word()

public word() : string
Return values
string

words()

public words([mixed $nb = 3 ][, mixed $asText = false ]) : array<string|int, mixed>|string
Parameters
$nb : mixed = 3
$asText : mixed = false
Return values
array<string|int, mixed>|string

year()

public year([mixed $max = '\'now\'' ]) : string
Parameters
$max : mixed = '\'now\''
Return values
string

callFormatWithMatches()

protected callFormatWithMatches(mixed $matches) : mixed
Parameters
$matches : mixed
Tags
deprecated

        
On this page

Search results