Download the PHP package malenki/fictif without Composer
On this page you can find all versions of the php package malenki/fictif. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package fictif
Fictif
Create random fictive people or some of their informations to use as fake data.
Use Only The Classes
In order to generate what you want, into the more simple way, I have design this library into several small parts. So, if you want only generate fake passwords, you can.
To use my classes into your own project, the best way is to use composer. So, edit your composer.json
and add this into require packages:
Birthday Class
Creating birthday dates is very simple. By default, this class can generate dates between 1900 and now, returning `string.
If you want, you can set minimal year and/or maximal year.
You can generate one like seen into previous examples, or many dates.
Simple, isn't it?
Email Class
This class is very flexible.
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.
Like for Birthday
class, you have generateOne()
and generateMany()
methods.
And, in string context, this class is like a string too.
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:
OK, but if you want femal firstnames only, you can do that:
For men, without surprise:
For names that can be both for women or men:
You can generate several at once too:
The LastName
class use only takeOne()
and takeMany()
methods, and works the same way as FirstName
class, including the toString()
behavior too.
Login Class
This is very simple to use. Only two methods: generateOne()
and generateMany()
. As others classes, use the toString()
behavior too.
This class generate login commposed of pseudo syllabs.
So, just for you, one example:
Password Class
Password Class allows you to play with length and characters.
You can give a minimal and/or maximal length:
If not set by you, the min/max are 5 and 20.
You can set the length to have always the same numbers of chars too:
You can add some characters…
or just use letters…
or just digits, as you want!
Putting it all together: The User Class
User class allows you to play with all previous classes together.
Each of them can be accessed by property. So, for example, to customize password, you can do that:
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:
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:
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.
Then, go to the root projects to execute this:
Composer only
You can use composer only
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:
Enjoy creating fake people!