PHPackages                             nicholasjohn16/generate - 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. [CLI &amp; Console](/categories/cli)
4. /
5. nicholasjohn16/generate

ActiveAnahita-extension[CLI &amp; Console](/categories/cli)

nicholasjohn16/generate
=======================

Generate Command for Anahita CLI

v1.0.0(8y ago)117GPL-3.0-onlyPHPPHP &gt;=5.6

Since Jun 27Pushed 7y ago1 watchersCompare

[ Source](https://github.com/NicholasJohn16/generate)[ Packagist](https://packagist.org/packages/nicholasjohn16/generate)[ RSS](/packages/nicholasjohn16-generate/feed)WikiDiscussions master Synced 2w ago

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

Generate Command
================

[](#generate-command)

The Generate Command is used to automatically generate sample data for testing and development.

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

[](#installation)

Installation is done through composer. Since this is a dev tool, requiring it as a dev tool so it's not installed in production.

```
composer require nicholasjohn16/generate --dev

```

Usage
-----

[](#usage)

The Genereate Command is integrated into Anahita's CLI. To use it, you just need to pass in the repo and entity name that you wish to generate sample data for. Optionally, you can pass in the number of entities to generate using the count argument. This is 10 by default.

```
anahita generate:sample repo.entity [--count|-c="..."] [relationships1] ... [relationshipsN]

```

For example:

```
anahita generate:sample people.person

```

The above command will generate 10 person entities.

### Relationships

[](#relationships)

Relationships can be specified when generating entities. For one to many relationships, you can optionally provide an id for the relationship by seperating the relationship name and id with a colon. If no id is provided, the child for the relationship will be randomly selected.

For example if we wanted to randomly generate a note with an owner of id 2 with a random author, we'd use the below command:

```
anahita generate:sample notes.note owner:2 author

```

Many to many relationships are not yet supported.

### Attributes

[](#attributes)

Attributes are generated randomly based on their entity definition. Non-required attributes have a chance of being null. If the generated value is null and they have a default value, the default value will be used instead. Faker PHP Library is used to generate the random values. The provider used for each attribute is based on the `config.json` settings. Each attribute type has it's own set of defaults, followed by defaults for each entity attributes. Attributes not listed in will be skipped over and not generated.

These defaults can be overriden and extended to include attributes for your own entities. For your own projects, create a `sample.json` file in the main directory of your Anahita installation and add an repo and entity object like below.

```
{
  "myrepo": {
    "myentity": {

    }
  }
}

```

Then within your entity, list any additional attributes that you'd like to be randomly generated. As well, you can optional override the provider used for the attribute type and any arguments that are passed to it. You can also override core defaults using the same method. Providers must return a string, int, boolean or DateTime object.

```
{
  "myrepo": {
    "myentity": {
      "bookISBN": {
        "provider": "isbn13"
      },
      "enabled": {
        "arguments": [50]
      },
      "subtitle": {}
    }
  }
}

```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

2925d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1107114?v=4)[Nick Swinford](/maintainers/NicholasJohn16)[@NicholasJohn16](https://github.com/NicholasJohn16)

---

Top Contributors

[![NicholasJohn16](https://avatars.githubusercontent.com/u/1107114?v=4)](https://github.com/NicholasJohn16 "NicholasJohn16 (8 commits)")

---

Tags

anahita-cli

### Embed Badge

![Health badge](/badges/nicholasjohn16-generate/health.svg)

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

###  Alternatives

[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24726.4M22](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

13045.3M6.2k](/packages/illuminate-console)[pulsestorm/pestle

A CLI framework for module based PHP code. Also has numerous Magento 2 code generation commands.

5324.7k](/packages/pulsestorm-pestle)

PHPackages © 2026

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