PHPackages                             floor9design/test-data-generator - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. floor9design/test-data-generator

ActiveLibrary[Testing &amp; Quality](/categories/testing)

floor9design/test-data-generator
================================

Classes to generate test data

1.5.0(3y ago)018.0k↑92.9%2MITPHPPHP &gt;=7.3CI passing

Since Dec 27Pushed 2y ago1 watchersCompare

[ Source](https://github.com/floor9design-ltd/test-data-generator)[ Packagist](https://packagist.org/packages/floor9design/test-data-generator)[ Docs](https://github.com/floor9design-ltd/test-data-generator)[ RSS](/packages/floor9design-test-data-generator/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (3)Versions (14)Used By (2)

test-data-generator
===================

[](#test-data-generator)

[![Latest Version](https://camo.githubusercontent.com/f134b62ca4b442ca990d7ccd1e7d2ff5eae30446b4f1fc8fa58c07a7172ed1d9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f666c6f6f723964657369676e2d6c74642f746573742d646174612d67656e657261746f723f696e636c7564655f70726572656c6561736573267374796c653d706c6173746963)](https://github.com/floor9design-ltd/test-data-generator/releases)[![Packagist](https://camo.githubusercontent.com/9c39307758a928f20cf12861d9f1d1ed27c54283d7e29a37a6dba12bdefcebae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666c6f6f723964657369676e2f746573742d646174612d67656e657261746f723f7374796c653d706c6173746963)](https://packagist.org/packages/floor9design/test-data-generator)[![Software License](https://camo.githubusercontent.com/10955426da15c7ed27f262e19d2eddeb65055494880cc858e8fc0792d5e15d1c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d706c6173746963)](LICENCE.md)

[![Build Status](https://camo.githubusercontent.com/fa4270f58608484d348aced3204417a6952bd23c6218545d2995bb6b4e05eb51/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f666c6f6f723964657369676e2d6c74642f746573742d646174612d67656e657261746f723f7374796c653d706c6173746963)](https://travis-ci.com/github/floor9design-ltd/test-data-generator)[![Code Coverage](https://camo.githubusercontent.com/1b53f335e21703870edb4aced1d21a3481ca57f07c8d5a4a92502b3c51e707f7/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f666c6f6f723964657369676e2d6c74642f746573742d646174612d67656e657261746f723f7374796c653d706c6173746963)](https://codecov.io/gh/floor9design-ltd/test-data-generator)

[![Github Downloads](https://camo.githubusercontent.com/a0e60b77a17710580701261b2ed597b042b7fb6156428c18ccc42e925b61ad3a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f666c6f6f723964657369676e2d6c74642f746573742d646174612d67656e657261746f722f746f74616c3f7374796c653d706c6173746963)](https://github.com/floor9design-ltd/test-data-generator)[![Packagist Downloads](https://camo.githubusercontent.com/9b6f80e3870ddc9d56d0a2452f886f0a3312ff6944820d3f975fff011c116dfd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666c6f6f723964657369676e2f746573742d646174612d67656e657261746f723f7374796c653d706c6173746963)](https://packagist.org/packages/floor9design/test-data-generator)

Introduction
------------

[](#introduction)

This offers a very simple class offering methods for basic data generation, ideal for unit tests or data filling. This is not meant to be a replacement for [fzaninotto/Faker](https://github.com/fzaninotto/Faker) or [fakerphp/faker](https://github.com/FakerPHP/Faker), but bear in mind that it is [Faker is retired](https://marmelab.com/blog/2020/10/21/sunsetting-faker.html) and both are pretty large includes for a production environment.

Some of the included functions are very simple, but the small amounts of code, such as filtering or formatting add up to a lot of duplication. In fact, this is the reason the package came about. It simply centralises this code, allowing a single point to catch all this nuance.

For example; it is simple to create a random date string, however there are several traps for random generation. MySQL date strings have bounds (after 1000-01-01), MySQL dates are padded with zeros (February is 02, not 2) and so on and so forth. By using this class these complexities are centralised and resolved in a well tested class structure.

Core functions are exposed, but there are also numerous quick aliases ready for use. For example, The core `randomMySqlDateTimeTimestamp` offers a safe bounded and correctly instantiated timestamp, which allows a safe call for `randomMySqlDate` and `randomMySqlDateTime`.

To be clear; the above example methods are simple, predefined lookups. They are simply just conveniently set-up methods. However, the methods are designed to allow custom output criteria. A formatted date output can easily be generated as well, such as `randomMySqlDate('l jS \of F Y h:i:s A')`. All relevant/appropriate methods do this also.

Features
--------

[](#features)

- simple response
- efficient installation
- quickly generate reliable fake data such as dates, passwords, numbers of different specs etc.

Install
-------

[](#install)

[![Packagist Downloads](https://camo.githubusercontent.com/9b6f80e3870ddc9d56d0a2452f886f0a3312ff6944820d3f975fff011c116dfd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666c6f6f723964657369676e2f746573742d646174612d67656e657261746f723f7374796c653d706c6173746963)](https://packagist.org/packages/floor9design/test-data-generator)

Via Composer

```
composer require floor9design/test-data-generator
```

[![Github Downloads](https://camo.githubusercontent.com/a0e60b77a17710580701261b2ed597b042b7fb6156428c18ccc42e925b61ad3a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f666c6f6f723964657369676e2d6c74642f746573742d646174612d67656e657261746f722f746f74616c3f7374796c653d706c6173746963)](https://github.com/floor9design-ltd/test-data-generator)

Via git

```
git clone https://github.com/floor9design-ltd/test-data-generator.git
```

Or:

```
git clone git@github.com:floor9design-ltd/test-data-generator.git
```

Usage
-----

[](#usage)

- [Usage](docs/project/usage.md)

Setup
-----

[](#setup)

These are a simple classes, so minimal setup is required. In a composer/PSR compliant system, this should be automatically included. If your system works another way, this can be manually included.

Note that they are namespaced, so should not clash with your other classes/methods.

Testing
-------

[](#testing)

[![Build Status](https://camo.githubusercontent.com/fa4270f58608484d348aced3204417a6952bd23c6218545d2995bb6b4e05eb51/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f666c6f6f723964657369676e2d6c74642f746573742d646174612d67656e657261746f723f7374796c653d706c6173746963)](https://travis-ci.com/github/floor9design-ltd/test-data-generator)[![Code Coverage](https://camo.githubusercontent.com/1b53f335e21703870edb4aced1d21a3481ca57f07c8d5a4a92502b3c51e707f7/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f666c6f6f723964657369676e2d6c74642f746573742d646174612d67656e657261746f723f7374796c653d706c6173746963)](https://codecov.io/gh/floor9design-ltd/test-data-generator)

To run the tests:

- `./vendor/phpunit/phpunit/phpunit`

Documentation and coverage can be generated as follows:

- `./vendor/phpunit/phpunit/phpunit --coverage-html docs/tests/`

Static analysis/code review can be performed by using [phpstan](https://phpstan.org/):

- `./vendor/bin/phpstan`

Gotcha: sometimes you may need to increase memory on docker/vagrant/virtual containers:

- `./vendor/bin/phpstan --memory-limit=1G`

Credits
-------

[](#credits)

- [Rick](https://github.com/elb98rm)

Changelog
---------

[](#changelog)

A changelog is generated here:

- [Change log](CHANGELOG.md)

License
-------

[](#license)

- [MIT](LICENCE.md)

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73.9% 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 ~65 days

Recently: every ~138 days

Total

13

Last Release

1227d ago

Major Versions

0.1.0 → 1.0.02020-12-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/ca241b0576f1570f1de86d5cb18429e6a662cc165c1e798d321754a549d65a27?d=identicon)[elb98rm](/maintainers/elb98rm)

---

Top Contributors

[![elb98rm](https://avatars.githubusercontent.com/u/2630101?v=4)](https://github.com/elb98rm "elb98rm (243 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (86 commits)")

---

Tags

datarandomseedtestingunit-testingtesttest datafloor9designtest data generator

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/floor9design-test-data-generator/health.svg)

```
[![Health](https://phpackages.com/badges/floor9design-test-data-generator/health.svg)](https://phpackages.com/packages/floor9design-test-data-generator)
```

###  Alternatives

[mockery/mockery

Mockery is a simple yet flexible PHP mock object framework

10.7k526.2M26.9k](/packages/mockery-mockery)[hamcrest/hamcrest-php

This is the PHP port of Hamcrest Matchers

7.0k513.4M122](/packages/hamcrest-hamcrest-php)[nelmio/alice

Expressive fixtures generator

2.5k45.2M166](/packages/nelmio-alice)[zenstruck/foundry

A model factory library for creating expressive, auto-completable, on-demand dev/test fixtures with Symfony and Doctrine.

79613.7M150](/packages/zenstruck-foundry)[php-mock/php-mock

PHP-Mock can mock built-in PHP functions (e.g. time()). PHP-Mock relies on PHP's namespace fallback policy. No further extension is needed.

37419.9M124](/packages/php-mock-php-mock)[brain/monkey

Mocking utility for PHP functions and WordPress plugin API

34214.3M483](/packages/brain-monkey)

PHPackages © 2026

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