PHPackages                             zarganwar/php-di-nextras-orm-extension - 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. zarganwar/php-di-nextras-orm-extension

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

zarganwar/php-di-nextras-orm-extension
======================================

1.0.0(2y ago)19PHPPHP ^8.1

Since Jan 4Pushed 2y ago2 watchersCompare

[ Source](https://github.com/Zarganwar/php-di-nextras-orm-extension)[ Packagist](https://packagist.org/packages/zarganwar/php-di-nextras-orm-extension)[ RSS](/packages/zarganwar-php-di-nextras-orm-extension/feed)WikiDiscussions main Synced 2d ago

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

How to use
----------

[](#how-to-use)

Create your model classes see [Nextras/Orm](https://nextras.org/orm)
--------------------------------------------------------------------

[](#create-your-model-classes-see-nextrasorm)

### Entities

[](#entities)

```
use Nextras\Orm\Entity\Entity;

/**
 * @property-read int $id {primary}
 * @property string $name
 */
final class Account extends Entity
{

}
```

### Mappers

[](#mappers)

```
use \Nextras\Orm\Mapper\Mapper;

final class AccountMapper extends Mapper
{

}
```

### Repositories

[](#repositories)

Use `RepositoryMapper` attribute to map repository to mapper class

```
use Zarganwar\PhpDiNextrasOrmExtension\NextrasOrmPhpDiExtension\Attributes\RepositoryMapper;
use Nextras\Orm\Repository\Repository;

#[RepositoryMapper(AccountMapper::class)]
final class AccountRepository extends Repository
{

	public static function getEntityClassNames(): array
	{
		return [Account::class];
	}

}
```

### Model

[](#model)

- Use `ModelRepository` attribute to map repository to model class.
- Every repository must be mapped to model class!
- !Do not configure model by [Nextras/Orm - Nette](https://nextras.org/orm/docs/main/config-nette)!

```
use Zarganwar\PhpDiNextrasOrmExtension\NextrasOrmPhpDiExtension\Attributes\ModelRepository;

#[ModelRepository(AccountRepository::class, 'accounts')]
// ...
// ...
final class Model extends \Nextras\Orm\Model\Model
{

}
```

Register extension
------------------

[](#register-extension)

Use Config class to configure extension

```
// config.php
use Zarganwar\PhpDiNextrasOrmExtension\NextrasOrmPhpDiExtension\Config;
use Zarganwar\PhpDiNextrasOrmExtension\NextrasOrmPhpDiExtension\OrmExtension;
use Psr\Container\ContainerInterface;

return [
    // Configure extension
	Config::class => fn(ContainerInterface $c) => new Config(
		cacheDirectory: __DIR__ . '/../var/cache',
		modelClass: Model::class,
		connection: [/* See class PhpDoc */]
	),

    // Register extension
	OrmExtension::class => fn(ContainerInterface $container) => new OrmExtension(
		$container,
		$container->get(Config::class),
	),
];
```

After container build call `OrmExtension::register` method

```
$containerBuilder = new DI\ContainerBuilder();
$containerBuilder->addDefinitions(__DIR__ . '/config.php');
$build = $containerBuilder->build();

$build->call([OrmExtension::class, 'register']);
```

Enjoy
-----

[](#enjoy)

```
$container->get(AccountRepository::class)->findAll(); // Returns Nextras\Orm\Collection\ICollection
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

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

912d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8614429?v=4)[Martin Jirásek](/maintainers/Zarganwar)[@Zarganwar](https://github.com/Zarganwar)

---

Top Contributors

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

---

Tags

nextras-ormphp-81php-diphp-di-container

### Embed Badge

![Health badge](/badges/zarganwar-php-di-nextras-orm-extension/health.svg)

```
[![Health](https://phpackages.com/badges/zarganwar-php-di-nextras-orm-extension/health.svg)](https://phpackages.com/packages/zarganwar-php-di-nextras-orm-extension)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[moodle/moodle

Moodle - the world's open source learning platform

7.2k88.5k88](/packages/moodle-moodle)[infinum/eightshift-libs

WordPress libs developed by Eightshift team to use in modern WordPress.

63125.5k3](/packages/infinum-eightshift-libs)[drupal-code-builder/drupal-code-builder

Code generator for Drupal

27253.3k1](/packages/drupal-code-builder-drupal-code-builder)[phlak/directory-lister

PHP directory lister

2.5k1.4k](/packages/phlak-directory-lister)

PHPackages © 2026

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