Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
F

faker-cli

> 编程语言
Open source

[PHP / CLI] Command Line Tool for the Faker PHP library.

175 stars0 likes0 views
WebsiteGitHub

About

[PHP / CLI] Command Line Tool for the Faker PHP library.

Faker Command Line Tool

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.

Usage

As a Phar (Recommended)

You can find the latest phar on the releases page.

bash
$ wget https://github.com/bit3/faker-cli/releases/download/1.4/faker.phar
$ ./faker.phar

As a Composer Install

bash
$ composer create-project bit3/faker-cli
$ cd faker-cli
$ ./bin/faker.php

Parameters and arguments

…

Single value generator example

$ ./bin/faker.php word

culpa
consequatur
quisquam
recusandae
asperiores
accusamus
nihil
repellat
vero
omnis

Multi value generator example

$ ./bin/faker.php --count 5 words 2

culpa,consequatur
quisquam,recusandae
asperiores,accusamus
nihil,repellat
vero,omnis

Output formats

You can use different output formats by definint the --format option. JSON is the default format.

JSON output

$ ./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"
    ]
]

XML output

$ ./bin/faker.php --format xml word

  culpa
  consequatur
  quisquam
  recusandae
  asperiores
  accusamus
  nihil
  repellat
  vero
  omnis

CSV output

$ ./bin/faker.php --format csv word

culpa
consequatur
quisquam
recusandae
asperiores
accusamus
nihil
repellat
vero
omnis

PHP output

$ ./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',
)

printf and vprintf output

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.

Build your own Phar

Install and run php-box:

bash
$ curl -LSs https://box-project.github.io/box2/installer.php | php
$ ./box.phar build

License

Faker Command Line Tool is released under the MIT Licence. See the bundled LICENSE file for details.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHP

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言