Download the PHP package joshmoody/mock-data without Composer
On this page you can find all versions of the php package joshmoody/mock-data. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download joshmoody/mock-data
More information about joshmoody/mock-data
Files in joshmoody/mock-data
Package mock-data
Short Description Generate realistic test data.
License MIT
Homepage https://github.com/joshmoody/mock-data
Informations about the package mock-data
Mock Data Generator
Generate realistic test data.
Why?
I work with very data-intensive applications. Sometimes I need large quantities of test data for building test cases and seeding web services, databases, online forms, etc. I wrote this library to assist with this.
With a simple loop, I can generate a database representing 100,000 people to use in my development and testing.
Base data sources included in this library
- US City/County/State/Zip Database
- First/Last Names from US Census
- Common U.S. Street Names
Mock Data Generation
Many different types of mock data can be generated with this library. From basic building blocks like numbers and dates to a Person with just about every attribute you need from a Date of Birth to Driver's License and Credit Card.
Data Realism
This library is designed to create very realistic-looking data.
- If generating a person:
- If a state is specified:
- The city will be a valid city in that state
- The area code, zip, and county will be correct for that city
- The SSN will be in a valid range for that state
- The email address will contain some portion of their name
- First/middle name will be appropriate for the selected gender
- For credit card numbers:
- The prefix and length will match the type of card generated (MasterCard, Visa, etc.)
- If a state is specified:
Usage
Example output:
Each type of data element above may be generated independently.
Names
Get a full name (first, middle, last, gender).
Why is gender is included as a property of the name? In the U.S., first and middle names are usually closely associated with gender.
Or get parts of a name:
Addresses
Get a full address with street, city, state, zip
Or gets parts of an address:
Phone Numbers
Internet
Random Data
In addition to realistic data generation, you can also use this library to easily pick a random value from an array.
Or get a boolean.
Or get a string representation of a boolean. You define the return values for true/false
Requirements
- MySQL or SQlite
- PHP >= 7.2 with SQlite PDO extension.
Installation
Installation of this package is easy with Composer. If you aren't familiar with the Composer Dependency Manager for PHP, you should read this first.
Zero Configuration Instructions
The package ships with a sqlite database containing all the data needed for generating random records.
Reloading Data
You can use the load script to regenerate the sqlite database at any time. This may be useful if modifying the source data to better fit your needs.
Acknowledgements
The geographic and demographic source data used in this library was derived from several places, including:
- http://www.unitedstateszipcodes.org/zip-code-database/
- http://www.50states.com/tools/postal.htm
- https://www.census.gov/genealogy/www/data/1990surnames/names_files.html
- http://www.livingplaces.com/streets/most-popular_street_names.html
License and copyright
Licensed under the MIT License. Copyright (c) 2013, Josh Moody. All rights reserved.