PHPackages                             statonlab/fields\_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. statonlab/fields\_generator

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

statonlab/fields\_generator
===========================

v0.1.12(7y ago)1881[7 issues](https://github.com/tripal/fields_generator/issues)[1 PRs](https://github.com/tripal/fields_generator/pulls)GPL-2.0PHPCI passing

Since Aug 21Pushed 2mo ago4 watchersCompare

[ Source](https://github.com/tripal/fields_generator)[ Packagist](https://packagist.org/packages/statonlab/fields_generator)[ Docs](https://github.com/statonlab/fields_generator)[ RSS](/packages/statonlab-fields-generator/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (10)Dependencies (1)Versions (19)Used By (0)

[![Build Status](https://camo.githubusercontent.com/e1790d4ea06de880255efcb9429be1c5b57562feaab02f7129bf52d16d3ca395/68747470733a2f2f7472617669732d63692e6f72672f74726970616c2f6669656c64735f67656e657261746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/tripal/fields_generator) [![DOI](https://camo.githubusercontent.com/ea2435512868d7d22e8ad48079ba494813ec759ffdc8ce9dcd8c6fae9d566251/68747470733a2f2f7a656e6f646f2e6f72672f62616467652f3130303734383235382e737667)](https://zenodo.org/badge/latestdoi/100748258)

Tripal Fields Generator
=======================

[](#tripal-fields-generator)

This is a CLI tool to help automate the generation of [Tripal fields](http://tripal.info/tutorials/v3.x/developers_handbook/custom-field) for use in [Tripal 3](http://tripal.info/) development. We highly recommend you read the developer handbook before attempting to use this tool. It supports creating both Tripal and Chado fields.

[![TFG hearthstone logo](/assets/TFG.png)](/assets/TFG.png)

Documentation
-------------

[](#documentation)

### Installation

[](#installation)

#### Using Composer

[](#using-composer)

The easiest way to install **Tripal Fields Generator** is using [Composer](https://getcomposer.org/).

**Install command**

```
composer global require "statonlab/fields_generator:~0.1"
```

**Update command**

```
composer global update
```

**Note:** make sure you export the composer bin directory by running the following command:

```
# Add this line to your .bashrc or .bash_profile to persist between shell sessions.
export PATH="$PATH:~/.composer/vendor/bin"
```

#### Manual installation

[](#manual-installation)

You can download this tool using the "[Clone or download](https://github.com/statonlab/fields_generator/archive/master.zip)" button above or cloning the repository using Git.

```
git clone https://github.com/statonlab/fields_generator.git
```

### Usage

[](#usage)

Generate a new field by running the following command and answering a few questions. By default, **Tripal Fields Generator** will generate a Chado field, but it can also generate Tripal fields.

```
# If installed globally with composer
makefield [--output|-o=/full/path/to/module]

# If installed manually without composer
./makefield [--output|-o=/full/path/to/module]
```

The generator will ask you for both the DB name and the CV name: these names correspond to the chado.db and chado.cv tables. If you aren't sure what these values are, you can use the [EBI Ontology lookup Service](http://www.ebi.ac.uk/ols/) CVterm entry as a guide: the DB name is the value in the *orange* box, and the CV name is the value in the *teal* box. For a full explanation, please read [the CV guide](CV_guide.md).

Alternatively, the below table shows the DB and CV values for commonly used ontologies in Tripal 3.

FULL NAMEDBCVDCMI metadata termsdcdcEagle-I Research OntologyEROeroEDAM datadataEDAMEDAM formatformatEDAMEDAM operationoperationEDAMEDAM topictopicEDAMFriend of a FriendfoaffoafGene ontology biological processGObiological\_processGene ontology cellular componentGOcellular\_componentGene ontology molecular functionGOmolecular\_functionhydrahydrahydraInformation Artifact OntologyIAOIAOlocallocallocalOntology for Biomedical InvestigationOBIOBIOntology for genetic intervalOGIogiOntology of Biological and Clinical StatisticsOBCSOBCSRelationship ontology (legacy)ROroResource Description Framework SchemardfsrdfsschemaschemaschemaSemanticscience Integrated OntologySIOSIOSequence ontologySOsequenceSoftware OntologySWOswoSystems BiologySBOsboTaxonomic RankTAXRANKtaxonomic\_rankIn order for Drupal to recognize your fields, you must...

- Place the file generated by this tool in the correct location (see below)
- Specify which bundles your field will attach to. Fields generated by this tool attach to the `organism` bundle by default.
- Clear the cache (`drush cc all`).
- Add the field in Structure-&gt;Tripal\_Content

#### Options

[](#options)

Optiondefaultdescriptionexample--output (-o)Current working directoryThe path to the module responsible for the field.`makefield -o="/var/www/html/sites/all/modules/my_module"`--type (-t)`chado`The type of field to generate. Choose between Chado which would extend ChadoField or Tripal to extend TripalField`makefield -t=tripal`### Output

[](#output)

**Tripal Fields Generator** will create four files that define your field. For the custom controlled vocabulary (CV) term `example` defined in the `local` CV, the field is defined in three files:

- The Fields class, `local__example.inc`
- The field formatter, `local__example_formatter.inc`
- The field widget, `local__example_widget.inc`

Additionally, a fields file stub describing the fields declared in your module is generated: for this example module, the file might be `tripal_example_module.fields.inc`. Note that *all* of the fields in your module are described here: running **Tripal Fields Generator** multiple times will require you to combine this file for each field. The final structure of your fields should look like the example below, with a given field `CV__CVTERM` in `module/includes/TripalFields/CV_CVterm`, and the `module.fields.inc` located in `module/includes`. For a full example of a field please visit the [Tripal Example Module repository](https://github.com/tripal/tripal_example) by [@laceysanderson](https://github.com/laceysanderson).

#### Output file structure

[](#output-file-structure)

By default, the module-level field file (`moduleName.fields.inc`) will be placed in `CV__CVterm_output`, and the classes defining your field will be in the field folder `CV__CVterm_output/CV__CVterm`. Note that the value of `CV` corresponds to what you enter for the *DB*, not the *CV* table!

```
CV__CVterm_output/
├── CV__CVterm/
│   ├── CV__CVterm.inc
│   ├── CV__CVterm_formatter.inc
│   └── CV__CVterm_widget.inc
└── module.fields.inc

```

You will need to move these files to conform to the pattern in the previous section. Alternatively, you may specify a different output path using the output flag, `-o="/path/to/module"` or `--output="/path/to/module"`. This will automatically define your fields in the correct place. In either case, your final module field structure should look like the example below.

```
module/
├── includes/
│   ├── TripalFields/
│   │   └── CV__CVterm/
│   │       ├── CV__CVterm.inc
│   │       ├── CV__CVterm_formatter.inc
│   │       └── CV__CVterm_widget.inc
│   └── module.fields.inc
└── rest of my module...

```

### Terms

[](#terms)

The below terms must be provided for each field you generate.

- **Field Label**: A human readable label for the field. e,g. Germplasm Summary
- **Field Description**: A human readable description of the field
- **Module Name**: The machine name of the module this field is distributed with. e,g. tripal\_germplasm\_module
- **Database name**:
- **CV name**:
- **Controlled Vocabulary Term**: The term name. e,g. germplasm\_summary
- **Accession**: The accession number for this term in the vocabulary, e,g. 30021. This must match the dbxref value in Chado. Biological CVs will always use numeric CVterms. Semantic CVs will generally use strings.

Examples
--------

[](#examples)

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

[](#contributing)

Contributions are highly welcomed and recommended.

- Fork the repository.
- Create a branch that contains your code.
- Create a pull request with a clear description of your contribution for us to review.

License
-------

[](#license)

This tool is licensed under [GNU GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html). Copyright 2017 [University of Tennessee](https://utk.edu). All rights reserved.

The Tripal Fields Generator "logo" is derived from the collectible card game Hearthstone, copyright © Blizzard Entertainment, Inc. Hearthstone® is a registered trademark of Blizzard Entertainment, Inc. Tripal Fields Generator is not affiliated or associated with or endorsed by Hearthstone® or Blizzard Entertainment, Inc.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~103 days

Total

13

Last Release

2671d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13967522?v=4)[Staton Laboratory](/maintainers/statonlab)[@statonlab](https://github.com/statonlab)

---

Top Contributors

[![bradfordcondon](https://avatars.githubusercontent.com/u/7063154?v=4)](https://github.com/bradfordcondon "bradfordcondon (65 commits)")[![almasaeed2010](https://avatars.githubusercontent.com/u/1512664?v=4)](https://github.com/almasaeed2010 "almasaeed2010 (64 commits)")[![florence-77](https://avatars.githubusercontent.com/u/50276746?v=4)](https://github.com/florence-77 "florence-77 (1 commits)")[![laceysanderson](https://avatars.githubusercontent.com/u/1566301?v=4)](https://github.com/laceysanderson "laceysanderson (1 commits)")

---

Tags

composertripaltripal-developer-toolstripal3

### Embed Badge

![Health badge](/badges/statonlab-fields-generator/health.svg)

```
[![Health](https://phpackages.com/badges/statonlab-fields-generator/health.svg)](https://phpackages.com/packages/statonlab-fields-generator)
```

###  Alternatives

[ec-europa/toolkit

Toolkit packaged for Drupal projects based on Robo.

39250.0k28](/packages/ec-europa-toolkit)

PHPackages © 2026

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