PHPackages                             phormium/modgen - 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. [Database &amp; ORM](/categories/database)
4. /
5. phormium/modgen

ActiveLibrary[Database &amp; ORM](/categories/database)

phormium/modgen
===============

Model class generator for Phormium.

0.2.1(12y ago)29322MITPHPPHP &gt;=5.3.0

Since Jan 15Pushed 11y ago1 watchersCompare

[ Source](https://github.com/ihabunek/phormium-modgen)[ Packagist](https://packagist.org/packages/phormium/modgen)[ Docs](https://github.com/ihabunek/phormium-modgen)[ RSS](/packages/phormium-modgen/feed)WikiDiscussions develop Synced 2mo ago

READMEChangelog (3)Dependencies (3)Versions (5)Used By (0)

Phormium Model Generator
========================

[](#phormium-model-generator)

Model class generator for [Phormium](https://github.com/ihabunek/phormium).

ModGen generates classes which extend Phormium\\Model from existing database tables. Currently supports MySQL, PostgreSQL, SQLite and Informix.

[![Latest Stable Version](https://camo.githubusercontent.com/92e49b040a17c02c128f312ebb82463eee0e870312df262f26109d4ad50cdf2e/68747470733a2f2f706f7365722e707567782e6f72672f70686f726d69756d2f6d6f6467656e2f762f737461626c652e706e67)](https://packagist.org/packages/phormium/modgen)[![Total Downloads](https://camo.githubusercontent.com/9e3f0de60e990e3f54673ca105284db5c7c6f304cd7e728d7091a522a65f00d6/68747470733a2f2f706f7365722e707567782e6f72672f70686f726d69756d2f6d6f6467656e2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/phormium/modgen)[![Build Status](https://camo.githubusercontent.com/f81cb9757c7d7fd36066c542c9350c83453e12ae5f7e2bf53acb672afa77477e/68747470733a2f2f7472617669732d63692e6f72672f69686162756e656b2f70686f726d69756d2d6d6f6467656e2e706e67)](https://travis-ci.org/ihabunek/phormium-modgen)

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

[](#installation)

### PHAR

[](#phar)

The simplest way to use ModGen is to download the latest version as a PHAR archive from the [releases page](https://github.com/ihabunek/phormium-modgen/releases) on GitHub.

You can now run ModGen:

```
php modgen.phar

```

This is abbreviated to `modgen` in the [usage examples](#usage).

### Packagist

[](#packagist)

You can also install from [Packagist](https://packagist.org/) using using [Composer](http://getcomposer.org/).

Create a file called `composer.json` with the following contents:

```
{
    "require": {
        "phormium/modgen": "0.*"
    }
}
```

Download composer and run:

```
php composer.phar install

```

The script for running modgen will be `vendor/bin/modgen` for \*nix and Mac and `vendor\bin\modgen.bat` for Windows users. This is abbreviated to `modgen` in the [usage examples](#usage).

Creating the PHAR
-----------------

[](#creating-the-phar)

To compile ModGen into a PHAR, clone the project from GitHub:

```
git clone https://github.com/ihabunek/phormium-modgen.git

```

Install the dependencies using Composer:

```
php composer.phar install

```

Run the compilation script:

```
php bin\compile

```

`modgen.phar` will be generated in your working directory.

Usage
-----

[](#usage)

Before starting, you need to have a Phormium configuration file which defines the database from which you want to generate models. If a config file is not specified, modgen will look for a file named "config.json" in the working directory.

Generate models for all tables in a database:

```
modgen generate [options]

```

Generate models for specified tables in a database:

```
modgen generate [options]  [table1] ... [tableN]

```

Options:

- `--config` - Path to the config file. (default: "config.json")
- `--target` - Target folder where the model will be generated (defaults to current working directory)
- `--namespace` - The PHP namespace used for the model classes. (default: "")
- `--help (-h)` - Display the help message.

Examples
--------

[](#examples)

Generate models for all tables in `backoffice` database, using namespace `Foo\Bar`:

```
modgen generate --namespace=Foo\\Bar backoffice

```

Generate models for tables `person` and `invoice` in the `backoffice` database, without a namespace:

```
modgen generate backoffice person invoice

```

License
-------

[](#license)

Licensed under the MIT license. See [LICENSE.md](LICENSE.md).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.5% 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 ~1 days

Total

3

Last Release

4501d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/69d0973e79ec870cb60522b5785e3e78e17d4b3569dde896d693b01a381c6f59?d=identicon)[ihabunek](/maintainers/ihabunek)

---

Top Contributors

[![ihabunek](https://avatars.githubusercontent.com/u/482138?v=4)](https://github.com/ihabunek "ihabunek (49 commits)")[![grobmeier](https://avatars.githubusercontent.com/u/873786?v=4)](https://github.com/grobmeier "grobmeier (3 commits)")[![bearzk](https://avatars.githubusercontent.com/u/775611?v=4)](https://github.com/bearzk "bearzk (1 commits)")

---

Tags

phpdatabasegeneratorormmapping

### Embed Badge

![Health badge](/badges/phormium-modgen/health.svg)

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

###  Alternatives

[wayofdev/laravel-cycle-orm-adapter

🔥 A Laravel adapter for CycleORM, providing seamless integration of the Cycle DataMapper ORM for advanced database handling and object mapping in PHP applications.

3516.7k3](/packages/wayofdev-laravel-cycle-orm-adapter)[bauer01/unimapper

Universal mapping tool for collecting data from different sources

112.6k6](/packages/bauer01-unimapper)[modul-is/orm

Lightweight hybrid ORM/Explorer

1118.1k](/packages/modul-is-orm)[proesio/pipe

PIPE - ORM en Español.

139.2k1](/packages/proesio-pipe)[bauer01/unimapper-flexibee

Flexibee implementation for UniMapper

101.1k](/packages/bauer01-unimapper-flexibee)

PHPackages © 2026

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