Email Class

By default, will take randomly domain and extension, the account is generated or can be set.

So, domain and extension can be fixed (i.e. always the same at every generation), or you can put your sets too.

$m = \Malenki\Fictif\Email();
$m->allowThisDomain(array('one','other')); // add new available domains
$m->allowThisExt(array('ru', 'jp')); // add some other extensions
//OR, for only one choice:
$m->setDomain('foo'); // will be always xxxx@foo.xx
$m->setExt('fr'); // will be always xxxx@xxx.fr

Like for Birthday class, you have generateOne() and generateMany() methods.

And, in string context, this class is like a string too.

$m = new \Malenki\Fictif\Email();
echo $m;

FirstName and LastName Classes

This classes have a lot of french samples of many origins, so, you can get a great variety of first and last names!

Using FirstName class is very simple. To get one random firstname, do the following:

$fn = new \Malenki\Fictif\FirstName();
echo $fn->takeOne();
// or just that in string context:
echo $fn;

Putting it all together: The User Class

Each of them can be accessed by property. So, for example, to customize password, you can do that:

$u = new \Malenki\Fictif\User();
$u->password->onlyDigits();

Simple, no?

But, if you want only some data, you can disable some of them by calling methods disableX() where X is the name of the property to disable. So, to disable login generator, just do:

$u = new \Malenki\Fictif\User();
$u->disableLogin();

As other classes, User class has generateOne() and generateMany(), but no toString() feature, and generateOne() return stdClass object.

Two other methods are avaible, to get json output:

$u = new \Malenki\Fictif\User();
$u->exportOneToJson(); // to have only one user
$u->exportManyToJson(10); // to have ten users

Use The CLI App

Before using the CLI app, be sure you have PHP CLI and composer installed on your system.

Git

Download the source code of this project, or just git clone it.

git clone https://github.com/malenkiki/fictif.git

Then, go to the root projects to execute this:

composer install

Composer only

You can use composer only

composer create-project malenki/fictif your-dir

Usage

After that, you can do a simple ./fictif to have the list of all available options. I think that help available into this CLI script is enough, no need to do more blahblah here ;-)

Try it, you can output result as JSON, serialized PHP or CSV.

Following lines show you the --help option output:

pc18:fictif michel$ ./fictif --help
Usage: fictif [OPTIONS]…
Create fake poeple to populate some database, website or any other app you want
while developing it. Fictif is the "Lorem ipsum" for data!
Disable some features
--no-password Do not create password
--no-login Do not create login
--no-birthday Do not create birthday
--no-email Do not create email
--only-women Create only women users.
--only-men Create only men users.
Birthday options
--min-year=YYYY Smaller four-digits year allowed for birthday. It
cannot be set before 1900.
--max-year=YYYY Greater year allowed for birthday, into 4 digits.
It cannot be greater than current year.
Email options
--eml-add-domains=LIST Add new domain's names to defaults. Separate them
by comma.
--eml-add-exts=LIST Add new extensions to defaults. Separate each
extensions by a comma.
--eml-set-domain=NAME Use only one domain NAME
--eml-set-ext=EXT Use only one extension EXT
Password options
--pwd-min-size=VALUE Smaller password string length allowed.
--pwd-max-size=VALUE Greater password string length allowed.
--pwd-one-size=VALUE Give size for a unique size password.
--pwd-other=VALUE Give some others characters to use in addition of
characters used by default..
--pwd-only-letters The password must have only letters.
--pwd-only-digits The password must have only digits.
Output options
-n, --amount=VALUE Users's quantity to create.
-j, --json Output result as JSON.
-p, --php Output result as serialized PHP code.
-c, --csv Output result as CSV. Unlike JSON and PHP, you must
provide "output" option too.
-o, --output=FILE File name into where the script writes its output
result. No need to give extension too, this is done
automatically
-h, --help Display this help message and exit
--version Display version information and exit