PHPackages                             nattreid/orm - 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. nattreid/orm

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

nattreid/orm
============

Extension Nextras/ORM

2.0.4(4y ago)06044MITPHPPHP &gt;= 7.4

Since Aug 3Pushed 4y ago1 watchersCompare

[ Source](https://github.com/nattreid/orm)[ Packagist](https://packagist.org/packages/nattreid/orm)[ RSS](/packages/nattreid-orm/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (4)Versions (83)Used By (4)

Rozšíření Nextras/ORM
=====================

[](#rozšíření-nextrasorm)

Nastavení **config.neon**

```
extensions:
    dbal: Nextras\Dbal\Bridges\NetteDI\DbalExtension
    orm: NAttreid\Orm\DI\OrmExtension

dbal:
    dbal:
    driver: mysqli
    host: 127.0.0.1
    database: test
    username: test
    password: test

orm:
    model: App\Model\Orm
    useCamelCase: true
    autoManageDb: true # automaticka kontrola tabulek a vytvareni neexistujicich
    add:
        - Another\Orm
```

Model
-----

[](#model)

```
namespace App\Model;

/**
 * @property-read ExampleRepository $example
 */
class Orm extends \Nextras\Orm\Model\Model {

}
```

Repository
----------

[](#repository)

```
class ExampleRepository extends \NAttreid\Orm\Repository {

    public static function getEntityClassNames() {
        return [Example::class];
    }
}
```

Mapper
------

[](#mapper)

```
class ExampleMapper extends \NAttreid\Orm\Mapper {

    protected function createTable(\NAttreid\Orm\Structure\Table $table) {
        $table->setDefaultDataFile(__DIR__.'/import.sql');

        $table->addPrimaryKey('id')
                ->int()
                ->setAutoIncrement();
        $table->addForeignKey('someId', SomeMapper::class);
        $table->addForeignKey('parentId', $table)
                ->setDefault(NULL);
        $table->addColumn('pa')
                ->varChar(20);
        $table->addColumn('allowed')
                ->boolean()
                ->setDefault(1)
                ->setKey();
        $table->addUnique('someId', 'parentId');
        $table->addFulltext('pa');

        $relationTable = $table->createRelationTable(OtherMapper::class);
        $relationTable->addForeignKey('exampleId', $table);
        $relationTable->addForeignKey('otherId', OtherMapper::class);
        $relationTable->setPrimaryKey('exampleId', 'otherId');

        // migrace
        if (!$relationTable->exists) {
            $table->migration[] = function (Row $row, Connection $connection) use ($relationTable) {
                if (isset($row->oldColumnId)) {
                    $connection->query('INSERT INTO %table %values', $relationTable->name, [
                        'exampleId' => $row->id,
                        'otherId' => $row->oldColumnId
                    ]);
                }
            };
        }

        $this->onCreateTable[] = function () {
            $this->insert([
                [
                    'id' => 1,
                    'someId' => 1,
                    'parentId' => 1,
                    'pa' => 'test',
                    // ...
                ]
            ]);
        };
    }
}
```

Entity
------

[](#entity)

```
/**
 * @property int $id {primary}
 * @property Some $some {m:1 Some, oneSided=true}
 * @property Example|NULL $parent {m:1 Example::$children}
 * @property OneHasMany|Example[] $children {1:m Example::$parent, orderBy=id}
 * @property string $pa
 * @property boolean $allowed {default TRUE}
 */
class Example extends \Nextras\Orm\Entity\Entity {

}
```

Dokumentace na adrese

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity79

Established project with proven stability

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

Recently: every ~10 days

Total

82

Last Release

1567d ago

Major Versions

1.11.0 → 2.0.02022-02-03

PHP version history (4 changes)1.0.0PHP &gt;= 5.6

1.5.4PHP &gt;= 7.0

1.6.0PHP &gt;= 7.1

2.0.0PHP &gt;= 7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a388aeb3f00b15a3af1c1a5d3a2107c94af1730c6043dd30ce32a63f95ea290?d=identicon)[attreid](/maintainers/attreid)

---

Top Contributors

[![attreid](https://avatars.githubusercontent.com/u/13151440?v=4)](https://github.com/attreid "attreid (1 commits)")

### Embed Badge

![Health badge](/badges/nattreid-orm/health.svg)

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

###  Alternatives

[ublaboo/datagrid

DataGrid for Nette Framework: filtering, sorting, pagination, tree view, table view, translator, etc

2972.0M24](/packages/ublaboo-datagrid)[kdyby/doctrine

Doctrine integration into Nette Framework

1091.0M86](/packages/kdyby-doctrine)[nettrine/orm

Doctrine ORM for Nette Framework

582.0M42](/packages/nettrine-orm)[nettrine/migrations

Doctrine Migrations for Nette Framework

411.8M19](/packages/nettrine-migrations)[nettrine/dbal

Doctrine DBAL for Nette Framework

322.7M20](/packages/nettrine-dbal)[contributte/monolog

Monolog integration into Nette Framework

242.0M7](/packages/contributte-monolog)

PHPackages © 2026

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