PHPackages                             goclearsky/name-gen - 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. goclearsky/name-gen

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

goclearsky/name-gen
===================

A CakePHP plugin to generate names for testing purposes

0.2.1(7y ago)05MITPHP

Since Nov 20Pushed 7y ago1 watchersCompare

[ Source](https://github.com/goclearsky/cakephp-name-gen)[ Packagist](https://packagist.org/packages/goclearsky/name-gen)[ RSS](/packages/goclearsky-name-gen/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (8)Used By (0)

NameGen plugin for CakePHP
==========================

[](#namegen-plugin-for-cakephp)

A plugin to generate random names as can be needed during development.

Installation
------------

[](#installation)

You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).

```
composer require goclearsky/name-gen

```

Use
---

[](#use)

The Generator class defines the getNames function.

```
static function getNames($size, $gender = null, $locale = null, $cardinality = 2)

```

Size is the number of people's names you are requesting. Gender is a single character. Locale is in the form of the typical locale values. Currently available are en\_US. The last parameter indicates the cardinality of each name generated. If middle names are desired, then use 3, otherwise 2 provides given and family names only.

```
cardinality == 3 ---> Amy Abigail Adams
cardinality == 2 ---> Amy Adams

```

If cardinality is 3, each name is checked to ensure the given and middle names are different. Irrespective of cardinality, the set is checked to ensure each name is unique.

Typical use might be to create a shell that requests a set of names using getNames, then saves them to your database tables as needed. Could also be used to quickly generate test source data.

```
namespace App\Shell;

use ClearSky\NameGen\Utility\Generator;

class DevShell extends Shell
{

    public static function name()
    {
        $names = Generator::getNames(3, 'F');

        $query = TableRegistry::get('Users')->query();
        $query->insert(['first_name', 'last_name']);
        foreach ($names as $name) {
            $query->values([
                'first_name' => $name['given'],
                'last_name' => $name['family'],
            ]);
        }
        $query->execute();

        print_r($names);
    }

}
```

The above shell generates the following output and saves these names in the users table;

```
miket@dev:~/workspace/myapp $ cake dev name
Array
(
    [0] => Array
        (
            [given] => Amy
            [family] => Jones
        )

    [1] => Array
        (
            [given] => Laura
            [family] => Brooks
        )

    [2] => Array
        (
            [given] => Sara
            [family] => Morgan
        )

)
miket@dev:~/workspace/myapp $
```

Contributing
------------

[](#contributing)

All suggestions and feedback are welcome. One thing that could help the general appeal of the plugin is to have more seeds for different countries.

Limitations / ToDo's
--------------------

[](#limitations--todos)

Add exception handling. The algorithm isn't exhaustive. It is possible to; a) request more names than are possible to uniquely provide based on the size of the pool to pull from, and b) request more names than are reasonable to return by simply randomly picking a name and checking for uniqueness. Because of this, `getNames()` can actually return a result set smaller than the number requested. If this is important, either check the set size upon return, or reduce the requested size in relation to the pool size. As it is, 5000 names can be generated in less than 1 second on 2012 hardware.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Total

7

Last Release

2727d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/42e0077d86dcef5e371331cc49cd418b380f1f2754bb36d04d4ee44defd247e8?d=identicon)[goclearsky](/maintainers/goclearsky)

---

Top Contributors

[![miketallroth](https://avatars.githubusercontent.com/u/4733342?v=4)](https://github.com/miketallroth "miketallroth (10 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/goclearsky-name-gen/health.svg)

```
[![Health](https://phpackages.com/badges/goclearsky-name-gen/health.svg)](https://phpackages.com/packages/goclearsky-name-gen)
```

###  Alternatives

[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

338920.1k32](/packages/dereuromark-cakephp-tools)[markstory/asset_compress

An asset compression plugin for CakePHP. Provides file concatenation and a flexible filter system for preprocessing and minification.

3761.0M11](/packages/markstory-asset-compress)[dereuromark/cakephp-shim

A CakePHP plugin to shim applications between major framework versions.

401.0M11](/packages/dereuromark-cakephp-shim)[cakedc/cakephp-phpstan

CakePHP plugin extension for PHPStan.

40676.6k31](/packages/cakedc-cakephp-phpstan)[dereuromark/cakephp-dto

A CakePHP plugin for generating immutable Data Transfer Objects with full type safety

2988.9k3](/packages/dereuromark-cakephp-dto)[dereuromark/cakephp-geo

A CakePHP plugin around geocoding tools and helpers.

51174.9k4](/packages/dereuromark-cakephp-geo)

PHPackages © 2026

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