PHPackages                             johnykvsky/dummygenerator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. johnykvsky/dummygenerator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

johnykvsky/dummygenerator
=========================

Dummy / fake data generator for modern PHP

v0.2.1(2mo ago)54.5k↓50%22MITPHPPHP ^8.3CI passing

Since Dec 19Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/johnykvsky/dummygenerator)[ Packagist](https://packagist.org/packages/johnykvsky/dummygenerator)[ RSS](/packages/johnykvsky-dummygenerator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (16)Used By (2)

DummyGenerator
==============

[](#dummygenerator)

[![logo](logo_d6.png)](logo_d6.png)

**Your Random Data Source**
---------------------------

[](#your-random-data-source)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://github.com/johnykvsky/dummygenerator/actions/workflows/php.yml/badge.svg)](https://github.com/johnykvsky/dummygenerator/actions/workflows/php.yml)[![Coverage Status](https://camo.githubusercontent.com/fda68d3b64bf0b72659551383c4913dc459928e6049bd689aed61536cf8401bd/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6a6f686e796b76736b792f64756d6d7967656e657261746f722f62616467652e737667)](https://coveralls.io/github/johnykvsky/dummygenerator)

Installation
============

[](#installation)

```
composer require johnykvsky/dummygenerator --dev
```

About
=====

[](#about)

**DummyGenerator** is dummy/fake data generator for PHP. It's a fork of Faker, heavily rewritten at core, but overall is same easy to use. In example:

```
$generator = DummyGenerator::create(); // all extensions are loaded
echo $generator->firstName();
```

Documentation
=============

[](#documentation)

Full documentation is available in [docs/index.md](docs/index.md)

But why...?
===========

[](#but-why)

Faker died for our because of being hard to maintain as mentioned in [sunsetting-faker](https://marmelab.com/blog/2020/10/21/sunsetting-faker.html). Faker 2.0 seems to be dead because of ["death by committee"](https://github.com/FakerPHP/Faker/discussions/15#discussioncomment-7787434) kind of stuff.

I needed simple dummy data generator for PHP 8.3, with modern architecture in mind. This is how **DummyGenerator** came to life.

Changes in compare to Faker
===========================

[](#changes-in-compare-to-faker)

- required PHP &gt;= 8.3
- PHPStan level 8 friendly
- PHPUnit tests for core and extensions (yep, some just check for not empty, but hey, it's random data)
- all `mt_rand` / `array_rand` replaced with `\Random\Randomizer`
- no static methods, only one magic method (`__call()` in generator)
- interfaces and dependency injection for everything (all core implementations can be replaced with different ones)
- implementations can be changed on the fly with `withDefinition()`
- language providers removed from core, that makes generator ~9.5Mb smaller
- changed `Uuid`, it supports `v4` only, use `uuid4()`
- removed database providers (core is only for dummy data generation)
- removed `HmlLorem`
- removed `File::filePath()` since it was interacting with system, not only generating dummy data
- `regexify` has been removed from core as it is not used any more, it's available in [dummyproviders](https://github.com/johnykvsky/dummyproviders) if needed
- added `Enum`, to get random values from PHP enums
- added `String`, to generate random string from given pool (as `text()` is not that good for short lengths)
- added support for `SystemClock`, PSR-20 implementation of Clock, used in date/time generation
- added `AnyDateTime`, as alternative/replacement for `DateTime` extension (see docs for more info)
- some extensions have updated properties, i.e. list of available currencies

Worth noticing:

- `DateTime` extension now also supports `DateTimeInterface` for methods params (not only strings)
- `boolean()` supports also float values from range 0 to 1, i.e. `->boolean(0.001)` for 0.1% chance

This package also fixes following problems with FakerPHP:

- `__destruct()` messing up with `seed()`
- bug with `unique()->optional()` causing massive memory usage
- not allowing combination of `valid` and `unique` (more about chaining in [strategies](./docs/strategies.md))
- `Factroy::create()` sharing state with other instances
- and other various items, mostly fixed by with switching to `\Random\Randomizer` and making proper use of it

But most of all: this is written from scratch, no looking back at old Fake architecture. Core is just an organizer (knows nothing about extensions or clock), depends on Container, which holds everything:

- Strategy (Unique, Valid, Chance...)
- Extensions (Person, Address, Internet...)
- Calculators (Iban, Ean...)
- Randomizer (\\Random\\Randomizer, Xoshiro256StarStar engine for seed...`)
- Clock (PSR-20)
- Replacer

And all that can be replaced with your own implementation. Check [overview](docs/overview.md) for more info.

Languages
=========

[](#languages)

One of main points of **DummyGenerator** is to keep core language agnostic. This is why **all** languages has been removed from core.

However, core use general English language for generating data.

`Person` extension provides only ~15 names than can be used as first name, last name, part of email etc. If you want more, check [dummyproviders](https://github.com/johnykvsky/dummyproviders) to get full providers for `en_US`,`en_GB` and `pl_PL`. I have created them to show how to make them / convert from old Faker, to allow anyone to work on other languages.

Keep in mind:

- **core will stay language agnostic** with some small samples (i.e. mentioned names) in English
- I have **no** current plans to support any language
- I have **no** current plans to work on extending/improving existing language providers.
- if someone like to make a PR to improve/extend one of mentioned languages - I will gladly look at it.
- I will not accept PRs with other languages - but I will gladly link in this readme to repositories with them.

Why PHP &gt;= 8.3
=================

[](#why-php--83)

Because of introduced in PHP 8.3:

- `Randomizer::getFloat()`
- `Randomizer::getBytesFromString()`
- and not so important but nice: typed class constants

What is this fake / dummy data
==============================

[](#what-is-this-fake--dummy-data)

When writing tests or populating test database you need to came up with various data, like first name, last name, some dates, maybe description, location coordinates and so on. When you deal with multi-language site and want to have it also multilanguage - you need to came up with every language names or address format.

All of that can be done by hand, but it's much easier to do `$generator->firstName()` and just don't care about what name it will be. Load provider and don't care about given locale names or phone formats.

Another use case - imagine you have description with 100 chars limit and want to test if it properly gives error when more is passed - instead of copying some text you can just use `$generator->text(150)` to get ~150 characters long text.

Last but not least - it make sure your tests will get random data on each run, not every single time same value. If your code is good and tests correct - then it should be no problem. If tests start failing from time to time - then what you think, where is the problem:

- with code
- with tests
- with random data, it should not be random

I leave answer to you. And yes, there might be cases when data should not be random, but usually it's not that case ;)

Other stuff
===========

[](#other-stuff)

There are two Randomizer implementations available:

- default `Randomizer`
- additional `XoshiroRandomizer`, which supports `seed` - to be used in tests

There is `script\ExtensionsDocs.php` that can be used to generate list of available extensions and their methods (look at `generate-spec.php`)

Since PHPUnit is still missing `--repeat`, in repository [phpunit-repeat](https://github.com/johnykvsky/phpunit-repeat) you can find Linux shell script for running tests multiple times.

TODO
----

[](#todo)

- cleanup tests

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance84

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.2% 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 ~43 days

Recently: every ~49 days

Total

11

Last Release

81d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e6d1e51d2c4b4cdc06e4021ece09aad572705b360b45a8d51f90e8a1dc462ac?d=identicon)[johnykvsky](/maintainers/johnykvsky)

---

Top Contributors

[![johnykvsky](https://avatars.githubusercontent.com/u/33696337?v=4)](https://github.com/johnykvsky "johnykvsky (56 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

fakergeneratorDummyFake data

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/johnykvsky-dummygenerator/health.svg)

```
[![Health](https://phpackages.com/badges/johnykvsky-dummygenerator/health.svg)](https://phpackages.com/packages/johnykvsky-dummygenerator)
```

###  Alternatives

[fakerphp/faker

Faker is a PHP library that generates fake data for you.

3.9k358.5M3.5k](/packages/fakerphp-faker)[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[simplesoftwareio/simple-qrcode

Simple QrCode is a QR code generator made for Laravel.

2.9k27.6M92](/packages/simplesoftwareio-simple-qrcode)

PHPackages © 2026

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