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

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

jpruliere/random-content-generator
==================================

RandomContentGenerator lets you set a mock Model layer in seconds

v1.1.0(7y ago)08MITPHPPHP &gt;=5.6.0

Since Feb 18Pushed 7y agoCompare

[ Source](https://github.com/jpruliere/random-content-generator)[ Packagist](https://packagist.org/packages/jpruliere/random-content-generator)[ RSS](/packages/jpruliere-random-content-generator/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (3)Used By (0)

RandomContentGenerator, random content generator 😏
==================================================

[](#randomcontentgenerator-random-content-generator-smirk)

RCG is a PHP class to be used as a mock Model layer. Its constructor takes a model array (see description below) and the expected collection size as parameters. Then you just have to call fetch() or fetchAll() on the generator and it will return one or many associative arrays containing randomly generated info.

```
// create a new generator with this simple line
$gen = new RandomContentGenerator(['id' => 'i:0-10000', 'title' => 't:3-10w', 'illustration' => 'p:1500*900'], 30);
// here we asked for a collection of 30 arrays, each having an 'id', a 'title' and an 'illustration'
// you can ask for 4 different types of data, each with their own options, using the syntax 'type:options'
// integer [type i], the only option is a range to limit possible values (here between 0 and 10k), you can omit it, it will default to 0 - mt_getrandmax()
// float [type f], same option, the range, defaults to 0 - 1
// text [type t], you have to provide a length as option, either fixed or varying (with the dash), either in words (w) or in sentences (s)
// picture [type p], you have to provide width and height with an asterisk as separator

// get your data
$gen->fetchAll(); // all at once
// $gen->fetch(); // or line by line

// or get model instances directly
$gen->fetchAllObj(ArtworkModel::class); // all at once
// $gen->fetchObj(ArtworkModel::class); // or one by one
```

Not fast enough ?
-----------------

[](#not-fast-enough-)

RCG comes with a built-in collection of 20 items with the following model :

- id : integer
- title : 4 to 6 words long text
- content : 5 sentences long text
- image : 400 by 300 picture

If you are happy with these settings, skip the parameters in the constructor ;-)

Changelog
---------

[](#changelog)

v1.0.0 - initial commit v1.1.0 - fetching as objects is available

Coming soon
-----------

[](#coming-soon)

- Date type
- Nested entity type

Thanks
------

[](#thanks)

- BaconIpsum for the fun mix of meat and latin vocabulary I stole from their API 😘
- LoremPicsum for their beautiful and stupidly simple API 😘

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

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 ~8 days

Total

2

Last Release

2632d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6ef401ba1cc9a5d9ce1b7750f8d0dcf3b26b4de041118ef7af0b3ca0e6c30825?d=identicon)[jpruliere](/maintainers/jpruliere)

### Embed Badge

![Health badge](/badges/jpruliere-random-content-generator/health.svg)

```
[![Health](https://phpackages.com/badges/jpruliere-random-content-generator/health.svg)](https://phpackages.com/packages/jpruliere-random-content-generator)
```

###  Alternatives

[violuke/php-barcodes

A collection of PHP classes for managing barcodes.

39578.6k3](/packages/violuke-php-barcodes)[setono/sylius-redirect-plugin

Sylius plugin for managing redirects

26352.1k](/packages/setono-sylius-redirect-plugin)

PHPackages © 2026

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