PHPackages                             mmo/faker-cli - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. mmo/faker-cli

ActiveProject[CLI &amp; Console](/categories/cli)

mmo/faker-cli
=============

A command line command for the Faker PHP library.

2.0.0(4y ago)07MITPHPPHP ^8.0

Since May 26Pushed 4y ago1 watchersCompare

[ Source](https://github.com/morawskim/faker-cli)[ Packagist](https://packagist.org/packages/mmo/faker-cli)[ RSS](/packages/mmo-faker-cli/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (21)Used By (0)

Faker Command Line Tool
=======================

[](#faker-command-line-tool)

This project is a fork of [bit3archive/faker-cli](https://github.com/bit3archive/faker-cli), which is no more maintained - see [comment](https://github.com/bit3archive/faker-cli/pull/8#issuecomment-354099233)

[Faker](https://github.com/FakerPHP/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
-----

[](#usage)

### As a Phar (Recommended)

[](#as-a-phar-recommended)

You can find the latest phar on the [releases page](https://github.com/morawskim/faker-cli/releases).

```
$ wget https://github.com/morawskim/faker-cli/releases/download/2.0.0/faker.phar
chmod +x ./faker.phar
$ ./faker.phar
```

### As a Composer Install

[](#as-a-composer-install)

```
$ composer create-project mmo/faker-cli
$ cd faker-cli
$ ./bin/faker.php
```

### Parameters and arguments

[](#parameters-and-arguments)

```
$ ./bin/faker.php
 --locale (-l)    # The locale to used. (default: "en_US")
 --seed (-s)      # The generators seed.
 --pattern (-p)   # The printf pattern. (default: "%s")
 --delimiter (-d) # The delimiter is used by the csv and printf format.
 --enclosure (-e) # The enclosure is used by the csv and printf format.
 --escape (-E)    # The escape character is used by the printf format. (default: "\\")
 --format (-f)    # The output format (json, xml, csv, php, printf, vprintf) (default: "printf")
 --count (-c)     # The count of generated data. (default: 1)
            # The data type to generate (e.g. "randomDigit", "words", "name", "city")
 .. # Arguments for the type, e.g. "words 5" will generate 5 words.

```

### Single value generator example

[](#single-value-generator-example)

```
$ ./bin/faker.php word

culpa
consequatur
quisquam
recusandae
asperiores
accusamus
nihil
repellat
vero
omnis

```

### Multi value generator example

[](#multi-value-generator-example)

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

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

```

### Output formats

[](#output-formats)

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

#### JSON output

[](#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

[](#xml-output)

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

  culpa
  consequatur
  quisquam
  recusandae
  asperiores
  accusamus
  nihil
  repellat
  vero
  omnis

```

#### CSV output

[](#csv-output)

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

culpa
consequatur
quisquam
recusandae
asperiores
accusamus
nihil
repellat
vero
omnis

```

#### PHP output

[](#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

[](#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`.

```
$ ./bin/faker.php --format printf \
  --pattern "INSERT INTO emails (uuid, email) VALUES (UUID(), %s);" \
  --enclosure "'" \
  safeEmail

INSERT INTO emails (uuid, email) VALUES (UUID(), 'dbednar@example.com');
INSERT INTO emails (uuid, email) VALUES (UUID(), 'xhettinger@example.net');
INSERT INTO emails (uuid, email) VALUES (UUID(), 'gerald62@example.org');
INSERT INTO emails (uuid, email) VALUES (UUID(), 'miles91@example.com');
INSERT INTO emails (uuid, email) VALUES (UUID(), 'to\'conner@example.com');
INSERT INTO emails (uuid, email) VALUES (UUID(), 'bridgette.runolfsdottir@example.com');
INSERT INTO emails (uuid, email) VALUES (UUID(), 'fgoldner@example.org');
INSERT INTO emails (uuid, email) VALUES (UUID(), 'grimes.leo@example.org');
INSERT INTO emails (uuid, email) VALUES (UUID(), 'lilian.reynolds@example.net');
INSERT INTO emails (uuid, email) VALUES (UUID(), 'ratke.darlene@example.net');

```

```
./bin/faker.php --format vprintf \
  --pattern "INSERT INTO keywords (uuid, keyword1, keyword2, keyword3) VALUES (UUID(), %s, %s, %s);" \
  --enclosure "'" \
  words 3

INSERT INTO keywords (uuid, keyword1, keyword2, keyword3) VALUES (UUID(), 'est', 'illo', 'consequuntur');
INSERT INTO keywords (uuid, keyword1, keyword2, keyword3) VALUES (UUID(), 'dolorem', 'temporibus', 'commodi');
INSERT INTO keywords (uuid, keyword1, keyword2, keyword3) VALUES (UUID(), 'sint', 'reiciendis', 'sint');
INSERT INTO keywords (uuid, keyword1, keyword2, keyword3) VALUES (UUID(), 'sunt', 'eum', 'id');
INSERT INTO keywords (uuid, keyword1, keyword2, keyword3) VALUES (UUID(), 'tempora', 'rerum', 'occaecati');
INSERT INTO keywords (uuid, keyword1, keyword2, keyword3) VALUES (UUID(), 'corrupti', 'impedit', 'doloribus');
INSERT INTO keywords (uuid, keyword1, keyword2, keyword3) VALUES (UUID(), 'amet', 'consectetur', 'repudiandae');
INSERT INTO keywords (uuid, keyword1, keyword2, keyword3) VALUES (UUID(), 'est', 'id', 'amet');
INSERT INTO keywords (uuid, keyword1, keyword2, keyword3) VALUES (UUID(), 'odio', 'facere', 'nesciunt');
INSERT INTO keywords (uuid, keyword1, keyword2, keyword3) VALUES (UUID(), 'voluptas', 'quia', 'rerum');

```

You can also use `printf` with multi value generator types, which will joined by the `--delimiter` char, which is `,` by default.

```
$ ./bin/faker.php --format printf \
  --pattern "INSERT INTO words (uuid, words) VALUES (UUID(), %s);" \
  --delimiter ' / ' \
  --enclosure "'" \
  words 10

INSERT INTO words (uuid, words) VALUES (UUID(), 'est / illo / consequuntur / dolorem / temporibus / commodi / sint / reiciendis / sint / sunt');
INSERT INTO words (uuid, words) VALUES (UUID(), 'eum / id / tempora / rerum / occaecati / corrupti / impedit / doloribus / amet / consectetur');
INSERT INTO words (uuid, words) VALUES (UUID(), 'repudiandae / est / id / amet / odio / facere / nesciunt / voluptas / quia / rerum');
INSERT INTO words (uuid, words) VALUES (UUID(), 'ad / sed / esse / sed / exercitationem / sed / et / rem / esse / excepturi');
INSERT INTO words (uuid, words) VALUES (UUID(), 'animi / minus / qui / perferendis / quo / repudiandae / aliquam / dolorem / voluptas / fugiat');
INSERT INTO words (uuid, words) VALUES (UUID(), 'at / odit / dolorem / a / aperiam / dignissimos / ipsa / sunt / consequatur / alias');
INSERT INTO words (uuid, words) VALUES (UUID(), 'accusantium / voluptatum / autem / nobis / cumque / neque / modi / iure / voluptatem / error');
INSERT INTO words (uuid, words) VALUES (UUID(), 'molestiae / consequatur / alias / eligendi / corrupti / illum / commodi / molestiae / aut / repellat');
INSERT INTO words (uuid, words) VALUES (UUID(), 'id / quisquam / et / sit / consequuntur / aut / et / ullam / asperiores / molestiae');
INSERT INTO words (uuid, words) VALUES (UUID(), 'cupiditate / culpa / voluptatem / et / mollitia / dolor / sit / nisi / praesentium / qui');

```

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.

Completion
----------

[](#completion)

Currently only bash is supported. Your `faker-cli.php` or `faker.phar` must be in your `PATH` env.

### Phar

[](#phar)

You must download `https://raw.githubusercontent.com/morawskim/faker-cli/master/completions/bash_completion.sh` somewhere and source this file in `.bashrc`

```
source DOWNLOAD_PATH/bash_completion.sh
```

### Composer

[](#composer)

You only need source `completions/bash_completion.sh` in your `.bashrc`

```
source PATH_TO_FAKER_CLI/completions/bash_completion.sh
```

Build your own Phar
-------------------

[](#build-your-own-phar)

Install and run php-box:

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

License
-------

[](#license)

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

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 62.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~221 days

Recently: every ~532 days

Total

14

Last Release

1498d ago

Major Versions

1.4.0 → 2.0.0-alpha.12022-04-09

PHP version history (3 changes)1.0PHP &gt;=5.3.3

1.0.4PHP &gt;=5.4

2.0.0-alpha.1PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f48903acba8913dc7efd484ee70d647f77d41f24a261aab64cb27231ea0b7aa?d=identicon)[morawskim](/maintainers/morawskim)

---

Top Contributors

[![tristanlins](https://avatars.githubusercontent.com/u/343404?v=4)](https://github.com/tristanlins "tristanlins (49 commits)")[![morawskim](https://avatars.githubusercontent.com/u/1105278?v=4)](https://github.com/morawskim "morawskim (23 commits)")[![EHER](https://avatars.githubusercontent.com/u/398034?v=4)](https://github.com/EHER "EHER (4 commits)")[![andreasbossard](https://avatars.githubusercontent.com/u/502464?v=4)](https://github.com/andreasbossard "andreasbossard (1 commits)")[![thiagorock22](https://avatars.githubusercontent.com/u/2721852?v=4)](https://github.com/thiagorock22 "thiagorock22 (1 commits)")

---

Tags

clifakerfixturesdata

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mmo-faker-cli/health.svg)

```
[![Health](https://phpackages.com/badges/mmo-faker-cli/health.svg)](https://phpackages.com/packages/mmo-faker-cli)
```

###  Alternatives

[n98/magerun

Tools for managing Magento projects and installations

1.4k264.7k7](/packages/n98-magerun)[mbezhanov/faker-provider-collection

A collection of custom providers for the Faker library

2138.6M24](/packages/mbezhanov-faker-provider-collection)[n98/magerun2

Tools for managing Magento projects and installations

928244.3k6](/packages/n98-magerun2)[laminas/laminas-cli

Command-line interface for Laminas projects

563.7M54](/packages/laminas-laminas-cli)[mahocommerce/maho

Free and open source ecommerce platform, created in 2024 on the M1 platform, PHP 8.3+

1322.1k12](/packages/mahocommerce-maho)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
