[PHP / CLI] Command Line Tool for the Faker PHP library.
[PHP / CLI] Command Line Tool for the Faker PHP library.
Faker is a PHP library that generates fake data for you. This is a command line tool for easy generation of fake data in a static way.
You can find the latest phar on the releases page.
$ wget https://github.com/bit3/faker-cli/releases/download/1.4/faker.phar
$ ./faker.phar$ composer create-project bit3/faker-cli
$ cd faker-cli
$ ./bin/faker.php…$ ./bin/faker.php word
culpa
consequatur
quisquam
recusandae
asperiores
accusamus
nihil
repellat
vero
omnis$ ./bin/faker.php --count 5 words 2
culpa,consequatur
quisquam,recusandae
asperiores,accusamus
nihil,repellat
vero,omnisYou can use different output formats by definint the --format option. JSON is the default format.
$ ./bin/faker.php word
[
"culpa",
"consequatur",
"quisquam",
"recusandae",
"asperiores",
"accusamus",
"nihil",
"repellat",
"vero",
"omnis"
]$ ./bin/faker.php --count 5 words 2
[
[
"culpa",
"consequatur"
],
[
"quisquam",
"recusandae"
],
[
"asperiores",
"accusamus"
],
[
"nihil",
"repellat"
],
[
"vero",
"omnis"
]
]$ ./bin/faker.php --format xml word
culpa
consequatur
quisquam
recusandae
asperiores
accusamus
nihil
repellat
vero
omnis
$ ./bin/faker.php --format csv word
culpa
consequatur
quisquam
recusandae
asperiores
accusamus
nihil
repellat
vero
omnis$ ./bin/faker.php --format php word
array (
0 => 'culpa',
1 => 'consequatur',
2 => 'quisquam',
3 => 'recusandae',
4 => 'asperiores',
5 => 'accusamus',
6 => 'nihil',
7 => 'repellat',
8 => 'vero',
9 => 'omnis',
)The printf and vprintf output are mostly equal. But printf is designed for single value generator types e.g. safeEmail and vprintf is designed for multi value generator types e.g. words 5.
……You can also use printf with multi value generator types, which will joined by the --delimiter char, which is , by default.
…It is recommend to use the --enclosure option. each occurrence of the --enclosure char will be escaped with the --escape char, which is \\ by default.
Install and run php-box:
$ curl -LSs https://box-project.github.io/box2/installer.php | php
$ ./box.phar buildFaker Command Line Tool is released under the MIT Licence. See the bundled LICENSE file for details.
No open issues yet, or sync has not completed.