PHPackages                             suilven/random-english - 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. suilven/random-english

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

suilven/random-english
======================

Generate random plausible English, for testing search engines

1.0.2(5y ago)023[2 issues](https://github.com/gordonbanderson/random_english/issues)MITPHPCI failing

Since Jun 28Pushed 5y ago1 watchersCompare

[ Source](https://github.com/gordonbanderson/random_english)[ Packagist](https://packagist.org/packages/suilven/random-english)[ RSS](/packages/suilven-random-english/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (15)Versions (4)Used By (0)

Random English
==============

[](#random-english)

[![Build Status](https://camo.githubusercontent.com/6be61922bb15611ab1b02e74ae3a53a0980d275a44ff7cc33021abddcceb9ea8/68747470733a2f2f7472617669732d63692e6f72672f676f72646f6e62616e646572736f6e2f72616e646f6d5f656e676c6973682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/gordonbanderson/random_english)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/5f002039912b297519f1bbcaefbb988dc0ea7123491d03fe9d58d2ef45091e08/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676f72646f6e62616e646572736f6e2f72616e646f6d5f656e676c6973682f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/gordonbanderson/random_english/?branch=master)[![codecov.io](https://camo.githubusercontent.com/2d355843cf45e1af4b2ac2c5bdc3b295eef52c0f7a5b2aae9dcde402db5e0a37/68747470733a2f2f636f6465636f762e696f2f6769746875622f676f72646f6e62616e646572736f6e2f72616e646f6d5f656e676c6973682f636f7665726167652e7376673f6272616e63683d6d6173746572)](https://codecov.io/github/gordonbanderson/random_english?branch=master)

[![Latest Stable Version](https://camo.githubusercontent.com/bc093ee3b328cc67b26cfe56296c4793ab2c758b1dc279fe90788b557256242b/68747470733a2f2f706f7365722e707567782e6f72672f7375696c76656e2f72616e646f6d2d656e676c6973682f76657273696f6e)](https://packagist.org/packages/suilven/random-english)[![Latest Unstable Version](https://camo.githubusercontent.com/6d48626bd179b5f893c2b0ae9ed92aa3a336568e49be0a17295b67a52fc12c69/68747470733a2f2f706f7365722e707567782e6f72672f7375696c76656e2f72616e646f6d2d656e676c6973682f762f756e737461626c65)](//packagist.org/packages/suilven/random-english)[![Total Downloads](https://camo.githubusercontent.com/68d608d664013a2ab4a71ab0bbeca11bf47484fee17ea00a3d2a0d133bdfbc61/68747470733a2f2f706f7365722e707567782e6f72672f7375696c76656e2f72616e646f6d2d656e676c6973682f646f776e6c6f616473)](https://packagist.org/packages/suilven/random-english)[![License](https://camo.githubusercontent.com/061f7bcd6e44c5115f1e4ebb21bd1523238026b45b971e3bb8141d2759558a70/68747470733a2f2f706f7365722e707567782e6f72672f7375696c76656e2f72616e646f6d2d656e676c6973682f6c6963656e7365)](https://packagist.org/packages/suilven/random-english)[![Monthly Downloads](https://camo.githubusercontent.com/6bc3a9f4cd00c9b240997c61c6233b3ced313ebff1564e2f0004199fa2c2c596/68747470733a2f2f706f7365722e707567782e6f72672f7375696c76656e2f72616e646f6d2d656e676c6973682f642f6d6f6e74686c79)](https://packagist.org/packages/suilven/random-english)[![Daily Downloads](https://camo.githubusercontent.com/3718abd0523a4d4983127c7e756918995b4a8ab5317df87b0603d5542eec0a70/68747470733a2f2f706f7365722e707567782e6f72672f7375696c76656e2f72616e646f6d2d656e676c6973682f642f6461696c79)](https://packagist.org/packages/suilven/random-english)[![composer.lock](https://camo.githubusercontent.com/49a8e9c19903323689ae7242ddea9f26b5d5fbcdecf3493f5c6dea9c3603e903/68747470733a2f2f706f7365722e707567782e6f72672f7375696c76656e2f72616e646f6d2d656e676c6973682f636f6d706f7365726c6f636b)](https://packagist.org/packages/suilven/random-english)

[![GitHub Code Size](https://camo.githubusercontent.com/40bbb70d6ac165be287089bc808b11b630b8ca9ad17414a8ce57a98eb5a969c2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f676f72646f6e62616e646572736f6e2f72616e646f6d5f656e676c697368)](https://github.com/gordonbanderson/random_english)[![GitHub Repo Size](https://camo.githubusercontent.com/f59d70b870984bc61865f38f4e464c15aaad5c898d657ad6d1f89be033041ad9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f676f72646f6e62616e646572736f6e2f72616e646f6d5f656e676c697368)](https://github.com/gordonbanderson/random_english)[![GitHub Last Commit](https://camo.githubusercontent.com/2b1613c2e511f911749c806bd07f6f034e904e2c2e353f25b61b816063074bd8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f676f72646f6e62616e646572736f6e2f72616e646f6d5f656e676c697368)](https://github.com/gordonbanderson/random_english)[![GitHub Activity](https://camo.githubusercontent.com/5bc4e72193ec4fd0bdfc3000755d077d8388620746153a315ce769538a06c235/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d69742d61637469766974792f6d2f676f72646f6e62616e646572736f6e2f72616e646f6d5f656e676c697368)](https://github.com/gordonbanderson/random_english)[![GitHub Issues](https://camo.githubusercontent.com/8bd3d8984c543e5d92bd030a2ad2e3c4969d06aab0e28164926e4e0b4b6496b4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f676f72646f6e62616e646572736f6e2f72616e646f6d5f656e676c697368)](https://github.com/gordonbanderson/random_english/issues)

[![codecov.io](https://camo.githubusercontent.com/3c0dd42c7f58d467f28019d0147ea89c025d908fd42f1f8cd4f00a202d8930a1/68747470733a2f2f636f6465636f762e696f2f6769746875622f676f72646f6e62616e646572736f6e2f72616e646f6d5f656e676c6973682f6272616e63682e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/3c0dd42c7f58d467f28019d0147ea89c025d908fd42f1f8cd4f00a202d8930a1/68747470733a2f2f636f6465636f762e696f2f6769746875622f676f72646f6e62616e646572736f6e2f72616e646f6d5f656e676c6973682f6272616e63682e7376673f6272616e63683d6d6173746572)

Generate random text that is plausible English, although it will not be semantically correct.

Getting Started
---------------

[](#getting-started)

Firstly there is no need for this software to be installed on a live system, it is purely intended for creating test data such as fixtures.

### Prerequisites

[](#prerequisites)

PHP 7.2 is required

```
Give examples

```

### Installing

[](#installing)

```
composer require --dev suilven/random-english

```

Usage
-----

[](#usage)

### Scripts

[](#scripts)

#### Random Sentences

[](#random-sentences)

The parameter 4 is the number of sentences to return

```
> bin/randomEnglish sentences 4
Shut in, however, by nine, it was terrible to sun his piano, which we had observed with the sorry house.
Foresting at night is more fun than seconding during the day.
Try!! You cannot wire here.
The minute is colour kenyan copper.

```

#### Random Paragraphs

[](#random-paragraphs)

The parameter 2 is the number of random paragraphs

```
> bin/randomEnglish paragraphs  2
Cat juices are best eaten with propers.  The spread in Pakistan is healthy.  The down is a storm of an female flog and is gold in the voice for his stomach and the mildness of his die.  Wait!! You cannot add here.  The park is colour cornflower blue.  Thea opened the tall and found that it led into a cheap fever, not much larger than a through.  The inside weather was paning on the across bank.  The further great double into the beer.  How slowly the hide passes here, encompassed as I am by fly and fit?  Among these were a couple of countrys, a toeing catch I employed sometimes, a sick hurting a skill, Gregg the butcher and his little boy, and two or three loafers and golf caddies who were accustomed to hang about the railway station.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Wish!! You cannot second here.  This is a random string from 1 to 4 two.  Tom's younger brother (or rather half-brother) Sid was already through with his part of the work (picking up chips), for he was a quiet boy, and had no adventurous, trouble-some ways.  The something gold ladder round the comb.  The decrease is a pull of an try were and is garden in the brush for his coin and the mildness of his come.  It was piano in the line, there star was sound.  Reminding at night is more fun than answering during the day.  Shut in, however, by road, it was through to fruit his cost, which we had observed with the model taste.  Were it not for the works, the south clean would not be out.  The salt film was snowing on the close bank.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

```

### PHP

[](#php)

Prime the generator with a configuration as below, or leave blank to choose random structures from `config/sentence-structure.cfg`

```
$generator = new RandomEnglishGenerator();
$generator->setConfig('It was [adjective] in the [noun], [contraction] [noun] was [adjective]');

$generator->sentence(); // generate a random sentence
$generator->title(); // generate a random sentence in Title Case
$generator->paragraph(10); // generate a random paragraph of up to a max of 10 sentences
```

Configuration
-------------

[](#configuration)

Sentence structures are defined in `config/sentence-structure.cfg` and look like this

```
The [noun] was [verb_ing] [adverb]
The [noun] in [country] is [adjective]
The [noun] is colour [colour]
This is a random string from 1 to 4 [one|two|three|four]

```

The random generation works as follows:

- A random line from the configuration file is chosen.
- Any words not in square brackets are output as is.
- A string of the form `[one|two|three|four]` represents a choice of random words, either `one`, `two`, `three` or `four` will be appended to the sentence.
- The directory `words` contains various text files with lists of words representative of the filename. A directive of `[noun]` will result in the file `words/english_nouns.txt` being loaded and a random word chosen from the file.
- Exceptions
    - `[country]` will load `words/english_countries.txt`, just a semanatic thing
    - `[verb_ing]` will take a verb and render if with a trailing `ing`
    - `[plural_noun]` will take a noun from the file `words/english_countable_nouns.txt` and pluralize it with an inflector
- The following are commands to run against Faker to generate random entries, e.g. `[lastName]` will generate a last name.

```
'address',
        'name',
        'randomDigit',
        'randomLetter',
        'randomNumber',
        'title',
        'titleMale',
        'titleFemale',
        'firstNameMale',
        'firstNameFemale',
        'lastName',

        'catchPhrase',
        'bs',
        'company',
        'companySuffix',
        'jobTitle',

        'realText',

        'dayOfWeek',
        'monthName',

```

Running the tests
-----------------

[](#running-the-tests)

1. Build Docker image and enter it in a bash shell

```
sudo docker-compse up -d phpcli
sudo docker-compose exec phpcli /bin/bash

```

Note the first step may take several minutes if not previously built.

A bash prompt will appear like this:

```
> sdc exec phpcli /bin/bash
 ____                 _                   _____             _ _     _
|  _ \ __ _ _ __   __| | ___  _ __ ___   | ____|_ __   __ _| (_)___| |__
| |_) / _` | '_ \ / _` |/ _ \| '_ ` _ \  |  _| | '_ \ / _` | | / __| '_ \
|  _ < (_| | | | | (_| | (_) | | | | | | | |___| | | | (_| | | \__ \ | | |
|_| \_\__,_|_| |_|\__,_|\___/|_| |_| |_| |_____|_| |_|\__, |_|_|___/_| |_|
                                                      |___/
root@randomenglish.test:/var/www>

```

Versioning
----------

[](#versioning)

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags).

Authors
-------

[](#authors)

- **Gordon Anderson** - *Initial work* - [Gordon Anderson](https://github.com/gordonbanderson)

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

Data Sources
------------

[](#data-sources)

- Wiktionary - different word classifications
- Mens Names - Office of National Statistics
- Womens Names - Office of National Statistics
- Countries - OSM Overpass API, [https://wiki.openstreetmap.org/wiki/Countries\_of\_the\_world](https://wiki.openstreetmap.org/wiki/Countries_of_the_world)
- Colours -

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~4 days

Total

3

Last Release

2139d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/770fae946ca5ca8f0f1f0179462c84d3ca60e9bd32cac3f522fdb64c2e384789?d=identicon)[suilven](/maintainers/suilven)

---

Top Contributors

[![gordonbanderson](https://avatars.githubusercontent.com/u/7060?v=4)](https://github.com/gordonbanderson "gordonbanderson (22 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/suilven-random-english/health.svg)

```
[![Health](https://phpackages.com/badges/suilven-random-english/health.svg)](https://phpackages.com/packages/suilven-random-english)
```

###  Alternatives

[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)[illuminate/support

The Illuminate Support package.

583107.1M34.5k](/packages/illuminate-support)[emanueleminotto/faker-service-provider

Faker Service Provider for Silex

162.9k](/packages/emanueleminotto-faker-service-provider)

PHPackages © 2026

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