Faker - Extensible Fake Data Generator
version 0.12
use Faker; my $faker = Faker->new; my $address = $faker->provider('Address'); my $color = $faker->provider('Color'); my $company = $faker->provider('Company'); my $internet = $faker->provider('Internet'); my $lorem = $faker->provider('Lorem'); my $payment = $faker->provider('Payment'); my $person = $faker->provider('Person'); my $telephone = $faker->provider('Telephone'); say $address->lines; say $color->name; say $company->name; say $internet->ip_address; say $lorem->sentences; say $payment->card_number; say $person->username; say $telephone->number; # or say $faker->address_lines; say $faker->color_name; say $faker->company_name; say $faker->internet_ip_address; say $faker->lorem_sentences; say $faker->payment_card_number; say $faker->person_username; say $faker->telephone_number;
Faker is a Perl 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 makes it easy to generate fake data. Note: This is an early release available for testing and feedback and as such is subject to change.
$faker->namespace('MyApp::FakeData');
The namespace attribute contains the namespace from which providers will be loaded. This attribute defaults to Faker::Provider.
$faker->locale('en_US');
The locale attribute contains the locale string which is concatenated with the namespace attribute to load fake data which is locale-specific.
$faker->provider('Company'); # Faker::Provider::en_US::Company
The provider method uses the namespace and locale attributes to load a particular provider which provides methods to generate fake data.
$faker->address_city_name; # Leathaville
The address_city_name method generates a random ficticious city name. This method is a proxy method which is the equivilent of calling the city_name method on the Faker::Provider::Address class.
city_name
$faker->address_city_prefix; # East
The address_city_prefix method generates a random ficticious city prefix. This method is a proxy method which is the equivilent of calling the city_prefix method on the Faker::Provider::en_US::Address class.
city_prefix
$faker->address_city_suffix; # town
The address_city_suffix method generates a random ficticious city suffix. This method is a proxy method which is the equivilent of calling the city_suffix method on the Faker::Provider::Address class.
city_suffix
$faker->address_country_name; # Maldives
The address_country_name method generates a random ficticious country name. This method is a proxy method which is the equivilent of calling the country_name method on the Faker::Provider::en_US::Address class.
country_name
$faker->address_latitude; # 71.339800
The address_latitude method generates a random ficticious latitude point. This method is a proxy method which is the equivilent of calling the latitude method on the Faker::Provider::Address class.
latitude
$faker->address_line1; # 55 Wolf Street
The address_line1 method generates a random ficticious street address. This method is a proxy method which is the equivilent of calling the line1 method on the Faker::Provider::Address class.
line1
$faker->address_line2; # Apt. 097
The address_line2 method generates a random ficticious address line2. This method is a proxy method which is the equivilent of calling the line2 method on the Faker::Provider::en_US::Address class.
line2
$faker->address_lines; # 23 West Parkway, Antoinetteford, 57654-9772
The address_lines method generates a random ficticious stree address. This method is a proxy method which is the equivilent of calling the lines method on the Faker::Provider::Address class.
lines
$faker->address_longitude; # 40.987408
The address_longitude method generates a random ficticious longitude point. This method is a proxy method which is the equivilent of calling the longitude method on the Faker::Provider::Address class.
longitude
$faker->address_number; # 5
The address_number method generates a random ficticious street number. This method is a proxy method which is the equivilent of calling the number method on the Faker::Provider::Address class.
number
$faker->address_postal_code; # 54708-5923
The address_postal_code method generates a random ficticious postal code. This method is a proxy method which is the equivilent of calling the postal_code method on the Faker::Provider::Address class.
postal_code
$faker->address_state_abbr; # MT
The address_state_abbr method generates a random ficticious state abbr. This method is a proxy method which is the equivilent of calling the state_abbr method on the Faker::Provider::en_US::Address class.
state_abbr
$faker->address_state_name; # Missouri
The address_state_name method generates a random ficticious state name. This method is a proxy method which is the equivilent of calling the state_name method on the Faker::Provider::en_US::Address class.
state_name
$faker->address_street_name; # Gottlieb Avenue
The address_street_name method generates a random ficticious street name. This method is a proxy method which is the equivilent of calling the street_name method on the Faker::Provider::Address class.
street_name
$faker->address_street_suffix; # Street
The address_street_suffix method generates a random ficticious street suffix. This method is a proxy method which is the equivilent of calling the street_suffix method on the Faker::Provider::Address class.
street_suffix
$faker->color_hex_code; # #f69e17
The color_hex_code method generates a random ficticious hex color. This method is a proxy method which is the equivilent of calling the hex_code method on the Faker::Provider::Color class.
hex_code
$faker->color_name; # DarkBlue
The color_name method generates a random ficticious color name. This method is a proxy method which is the equivilent of calling the name method on the Faker::Provider::Color class.
name
$faker->color_rgbcolors; # 191,5,180
The color_rgbcolors method generates a random ficticious rgb colors. This method is a proxy method which is the equivilent of calling the rgbcolors method on the Faker::Provider::Color class.
rgbcolors
$faker->color_rgbcolors_array; # [217,103,213]
The color_rgbcolors_array method generates a random ficticious rgb colors. This method is a proxy method which is the equivilent of calling the rgbcolors_array method on the Faker::Provider::Color class.
rgbcolors_array
$faker->color_rgbcolors_css; # rgb(173,240,91)
The color_rgbcolors_css method generates a random ficticious rgbcolors for css. This method is a proxy method which is the equivilent of calling the rgbcolors_css method on the Faker::Provider::Color class.
rgbcolors_css
$faker->color_safe_hex_code; # #ff003e
The color_safe_hex_code method generates a random ficticious safe hex color. This method is a proxy method which is the equivilent of calling the safe_hex_code method on the Faker::Provider::Color class.
safe_hex_code
$faker->color_safe_name; # fuchsia
The color_safe_name method generates a random ficticious safe color name. This method is a proxy method which is the equivilent of calling the safe_name method on the Faker::Provider::Color class.
safe_name
$faker->company_buzzword_type1; # synergize
The company_buzzword_type1 method generates a random ficticious buzzword type1. This method is a proxy method which is the equivilent of calling the buzzword_type1 method on the Faker::Provider::en_US::Company class.
buzzword_type1
$faker->company_buzzword_type2; # vertical
The company_buzzword_type2 method generates a random ficticious buzzword type2. This method is a proxy method which is the equivilent of calling the buzzword_type2 method on the Faker::Provider::en_US::Company class.
buzzword_type2
$faker->company_buzzword_type3; # methodologies
The company_buzzword_type3 method generates a random ficticious buzzword type3. This method is a proxy method which is the equivilent of calling the buzzword_type3 method on the Faker::Provider::en_US::Company class.
buzzword_type3
$faker->company_description; # Delivers discrete processimprovement
The company_description method generates a random ficticious description. This method is a proxy method which is the equivilent of calling the description method on the Faker::Provider::en_US::Company class.
description
$faker->company_jargon_buzz_word; # encryption
The company_jargon_buzz_word method generates a random ficticious jargon buzz word. This method is a proxy method which is the equivilent of calling the jargon_buzz_word method on the Faker::Provider::en_US::Company class.
jargon_buzz_word
$faker->company_jargon_edge_word; # Public-key
The company_jargon_edge_word method generates a random ficticious jargon edge word. This method is a proxy method which is the equivilent of calling the jargon_edge_word method on the Faker::Provider::en_US::Company class.
jargon_edge_word
$faker->company_jargon_prop_word; # upward-trending
The company_jargon_prop_word method generates a random ficticious jargon proposition word. This method is a proxy method which is the equivilent of calling the jargon_prop_word method on the Faker::Provider::en_US::Company class.
jargon_prop_word
$faker->company_name; # Quitzon Inc.
The company_name method generates a random ficticious company name. This method is a proxy method which is the equivilent of calling the name method on the Faker::Provider::Company class.
$faker->company_name_suffix; # Inc.
The company_name_suffix method generates a random ficticious company name suffix. This method is a proxy method which is the equivilent of calling the name_suffix method on the Faker::Provider::Company class.
name_suffix
$faker->company_tagline; # mindshare customized seize
The company_tagline method generates a random ficticious tagline. This method is a proxy method which is the equivilent of calling the tagline method on the Faker::Provider::en_US::Company class.
tagline
$faker->internet_domain_name; # bauch-co.net
The internet_domain_name method generates a random ficticious domain name. This method is a proxy method which is the equivilent of calling the domain_name method on the Faker::Provider::Internet class.
domain_name
$faker->internet_domain_word; # jerde-gulgowski
The internet_domain_word method generates a random ficticious domain word. This method is a proxy method which is the equivilent of calling the domain_word method on the Faker::Provider::Internet class.
domain_word
$faker->internet_email_address; # jessy.kunze\@brekke-cartwright.net
The internet_email_address method generates a random ficticious email address. This method is a proxy method which is the equivilent of calling the email_address method on the Faker::Provider::Internet class.
email_address
$faker->internet_email_domain; # gmail.com
The internet_email_domain method generates a random ficticious email domain. This method is a proxy method which is the equivilent of calling the email_domain method on the Faker::Provider::Internet class.
email_domain
$faker->internet_ip_address; # 151.127.26.209
The internet_ip_address method generates a random ficticious ip address. This method is a proxy method which is the equivilent of calling the ip_address method on the Faker::Provider::Internet class.
ip_address
$faker->internet_ip_address_v4; # 165.132.192.226
The internet_ip_address_v4 method generates a random ficticious ip address v4. This method is a proxy method which is the equivilent of calling the ip_address_v4 method on the Faker::Provider::Internet class.
ip_address_v4
$faker->internet_ip_address_v6; # 8ae5:e9ac:e5fb:4fc2:7763:fa5e:aaf4:8120
The internet_ip_address_v6 method generates a random ficticious ip address v6. This method is a proxy method which is the equivilent of calling the ip_address_v6 method on the Faker::Provider::Internet class.
ip_address_v6
$faker->internet_root_domain; # org
The internet_root_domain method generates a random ficticious root domain. This method is a proxy method which is the equivilent of calling the root_domain method on the Faker::Provider::Internet class.
root_domain
$faker->internet_url; # http://bauch-runte-and-ondricka.info/
The internet_url method generates a random ficticious url. This method is a proxy method which is the equivilent of calling the url method on the Faker::Provider::Internet class.
url
$faker->lorem_paragraph; # velit vitae molestiae ut dolores. amet est qui rem placeat accusamus # accusamus labore. qui quidem expedita non.\n\n
The lorem_paragraph method generates a random ficticious paragraph. This method is a proxy method which is the equivilent of calling the paragraph method on the Faker::Provider::Lorem class.
paragraph
$faker->lorem_paragraphs; # nobis minus aut nam. odio autem fuga et reprehenderit. magnam eius et # possimus.\n\nvelit nam vel nam harum maxime id dolorum. sed ut molestiae # cumque voluptas aspernatur quidem aut dicta. officia laborum dolorem ab # ipsa deleniti.\n\n
The lorem_paragraphs method generates a random ficticious paragraphs. This method is a proxy method which is the equivilent of calling the paragraphs method on the Faker::Provider::Lorem class.
paragraphs
$faker->lorem_sentence; # animi iure quo assumenda est.
The lorem_sentence method generates a random ficticious sentence. This method is a proxy method which is the equivilent of calling the sentence method on the Faker::Provider::Lorem class.
sentence
$faker->lorem_sentences; # placeat beatae qui aliquid. distinctio quasi repudiandae hic id. # explicabo culpa debitis excepturi aliquam quo ea.
The lorem_sentences method generates a random ficticious sentences. This method is a proxy method which is the equivilent of calling the sentences method on the Faker::Provider::Lorem class.
sentences
$faker->lorem_word; # quidem
The lorem_word method generates a random ficticious word. This method is a proxy method which is the equivilent of calling the word method on the Faker::Provider::Lorem class.
word
$faker->lorem_words; # voluptatibus officia delectus unde sed
The lorem_words method generates a random ficticious words. This method is a proxy method which is the equivilent of calling the words method on the Faker::Provider::Lorem class.
words
$faker->payment_card_expiration; # 02/17
The payment_card_expiration method generates a random ficticious credit card expiration date. This method is a proxy method which is the equivilent of calling the card_expiration method on the Faker::Provider::Payment class.
card_expiration
$faker->payment_card_number; # 37814449158323
The payment_card_number method generates a random ficticious credit card number. This method is a proxy method which is the equivilent of calling the card_number method on the Faker::Provider::Payment class.
card_number
$faker->payment_vendor; # MasterCard
The payment_vendor method generates a random ficticious credit card vendor. This method is a proxy method which is the equivilent of calling the vendor method on the Faker::Provider::Payment class.
vendor
$faker->person_first_name; # John
The person_first_name method generates a random ficticious first name. This method is a proxy method which is the equivilent of calling the first_name method on the Faker::Provider::Person class.
first_name
$faker->person_last_name; # Doe
The person_last_name method generates a random ficticious last name. This method is a proxy method which is the equivilent of calling the last_name method on the Faker::Provider::Person class.
last_name
$faker->person_name; # Jane Doe
The person_name method generates a random ficticious full name. This method is a proxy method which is the equivilent of calling the name method on the Faker::Provider::Person class.
$faker->person_name_prefix; # Miss
The person_name_prefix method generates a random ficticious name prefix. This method is a proxy method which is the equivilent of calling the name_prefix method on the Faker::Provider::en_US::Person class.
name_prefix
$faker->person_name_suffix; # III
The person_name_suffix method generates a random ficticious name suffix. This method is a proxy method which is the equivilent of calling the name_suffix method on the Faker::Provider::en_US::Person class.
$faker->person_username; # Jane.Doe
The person_username method generates a random ficticious username. This method is a proxy method which is the equivilent of calling the username method on the Faker::Provider::Person class.
username
$faker->telephone_number; # (111) 456-1127
The telephone_number method generates a random ficticious telephone number. This method is a proxy method which is the equivilent of calling the number method on the Faker::Provider::Telephone class.
Some parts of this library were adopted from the following implementations.
JS Faker https://github.com/Marak/faker.js
PHP Faker https://github.com/fzaninotto/Faker
Python Faker https://github.com/joke2k/faker
Ruby Faker https://github.com/stympy/faker
Al Newkirk <anewkirk@ana.io>
This software is copyright (c) 2014 by Al Newkirk.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Faker, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Faker
CPAN shell
perl -MCPAN -e shell install Faker
For more information on module installation, please visit the detailed CPAN module installation guide.