PHPackages                             stepapo/model - 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. stepapo/model

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

stepapo/model
=============

Library that uses structured DB definitions to generate DDL and DML queries and Nextras ORM entity properties.

0102PHP

Since Jul 3Pushed 2w ago1 watchersCompare

[ Source](https://github.com/stepapo/model)[ Packagist](https://packagist.org/packages/stepapo/model)[ RSS](/packages/stepapo-model/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Model
=====

[](#model)

Library that uses structured DB definitions to generate DDL and DML queries and Nextras ORM entity properties.

Instalation
-----------

[](#instalation)

1. run composer

```
composer require stepapo/model
```

2. `config/config.neon`

```
extensions:
    stepapo.model: Stepapo\Model\DI\ModelExtension

stepapo.model:
    parameters: # array of parameters to use in various configurations,
    testMode: # true or false,
    driver: # mysql|pqsql,
    database: # default db schema,
    schemas: # array of schemas to work with
```

Usage
-----

[](#usage)

### Definitions

[](#definitions)

Analyzes database schemas, tables and columns, compares to Definition configs and runs DDL queries if needed. Requires Nette DI and Nextras Dbal.

- `config/definitions/db.neon`

```
schemas:
    public:
        tables:
            person:
                columns:
                    id: [type: int, null: false, auto: true]
                    email: [type: string, null: false]
                    first_name: [type: string, null: false]
                    last_name: [type: string, null: false]
                    created_at: [type: datetime, null: false, default: now]
                    updated_at: [type: datetime, null: true]
                primaryKey: id
                uniqueKeys: [email]
```

- `bin/processDefinitions.php`

```
App\Bootstrap::boot()
    ->createContainer()
    ->getByType(Stepapo\Model\Definition\DbProcessor::class)
    ->process([__DIR__ . '/../config/definitions']);
```

### Manipulations

[](#manipulations)

Analyzes database rows, compares to Manipulation configs and runs DML queries if needed. Requires Nette DI and Nextras ORM.

- `Build\Model\Person\Person.php`

You can generate entity properties with [Webovac Generator](https://github.com/webovac/generator#entity-properties).

```
namespace Build\Model\Person;

use Build\Model\Person\PersonData;

/**
 * @property int $id {primary}
 *
 * @property string $firstName
 * @property string $lastName
 * @property string|null $email
 *
 * @property DateTimeImmutable $createdAt {default now}
 * @property DateTimeImmutable|null $updatedAt
 *
 * @method PersonData getData()
 */
class Person extends Stepapo\Model\Orm\StepapoEntity
{
    public function getDataClass(): string
    {
        return PersonData::class;
    }
}
```

- `Build\Model\Person\PersonData.php`

```
namespace Build\Model\Person;

class PersonData extends Stepapo\Model\Data\Item
{
    public ?int $id;
    public string $email;
    public string $firstName;
    public string $lastName;
}
```

- `Build\Model\Person\PersonRepository.php`

```
namespace Build\Model\Person;

class PersonRepository extends Stepapo\Model\Orm\StepapoRepository
{
}
```

- `config/manipulations/persons.neon`

```
class: Build\Model\Person\PersonData
items:
    admin:
        email: 'admin@test.test'
        firstName: admin
        lastName: admin
    user:
        email: 'user@test.test'
        firstName: user
        lastName: user
```

- `bin/processManipulations.php`

```
App\Bootstrap::boot()
    ->createContainer()
    ->getByType(Stepapo\Model\Manipulation\Processor::class)
    ->process([__DIR__ . '/../config/manipulations']);
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance63

Regular maintenance activity

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11784270?v=4)[Štěpán Postler](/maintainers/stepapo)[@stepapo](https://github.com/stepapo)

---

Top Contributors

[![stepapo](https://avatars.githubusercontent.com/u/11784270?v=4)](https://github.com/stepapo "stepapo (94 commits)")

### Embed Badge

![Health badge](/badges/stepapo-model/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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