PHPackages                             darkling/nette-identity-doctrine - 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. darkling/nette-identity-doctrine

ActiveNette-addon[Database &amp; ORM](/categories/database)

darkling/nette-identity-doctrine
================================

Integration of entities implementing IIdentity in Nette 3

1.0(6y ago)0823MITPHPPHP &gt;=7.4CI failing

Since Jan 6Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Daaarkling/nette-identity-doctrine)[ Packagist](https://packagist.org/packages/darkling/nette-identity-doctrine)[ RSS](/packages/darkling-nette-identity-doctrine/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (13)Versions (4)Used By (0)

Nette 3 &amp; Doctrine 2 entities
=================================

[](#nette-3--doctrine-2-entities)

Nette addon for using Doctrine 2 entities directly as Nette identity. Based on [Majkl578/nette-identity-doctrine](https://github.com/Majkl578/nette-identity-doctrine)

Motivation
----------

[](#motivation)

If you are using Nette 3 and Doctrine 2 together, you will sooner or later want to use some of your entities also as identity, because it is practical.

Fortunately, this addon is here to help you with this task!

Requirements
------------

[](#requirements)

- PHP 7.4+
- Nette 3
- Doctrine ORM 2.6+

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

[](#installation)

1. Install via composer:

    `composer require darkling/nette-identity-doctrine`
2. Register extension in your configuration file in extensions section:

    ```
    extensions:
        - Darkling\Doctrine2Identity\DI\IdentityExtension
    ```
3. Delete cache.

You're done. ;)

Usage
-----

[](#usage)

Imagine you have an application where you're implementing authentication. All you have is a regular entity for the user in your application. Now you want to implement the authentication itself - you need to have an identity. The only thing you have to do is to implement `Nette\Security\IIdentity` on your user entity, so you get something like this:

```
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 */
class UserEntity implements IIdentity
{
	/** @ORM\Column(type="integer") @ORM\Id @ORM\GeneratedValue */
	private $id;

	/** @ORM\Column */
	private $name;

	... other properties, getters & setters

	/* implementation of IIdentity */
	public function getId()
	{
		return $this->id;
	}

	public function getRoles()
	{
		return [];
	}
}
```

(Notice the empty getRoles() method. That is due to the requirement of IIdentity. If you don't use authorization, unfortunately, it can't be omitted, sorry.)

That's all. Everything is automatic! And you can even use entities with composite identifiers!

Issues
------

[](#issues)

In case of any problems, just leave an issue here on GitHub (or, better, send a pull request).

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Total

3

Last Release

2223d ago

Major Versions

0.2 → 1.02020-04-09

PHP version history (2 changes)0.1PHP &gt;=7.1

1.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/a3a1ebc17cd3687e9942c0398a454a8f1753fac05cd4f6ffca1b8a4793d3c412?d=identicon)[Daaarkling](/maintainers/Daaarkling)

---

Top Contributors

[![Daaarkling](https://avatars.githubusercontent.com/u/10207494?v=4)](https://github.com/Daaarkling "Daaarkling (6 commits)")

---

Tags

nettesecurityAuthenticationormdoctrineidentity

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/darkling-nette-identity-doctrine/health.svg)

```
[![Health](https://phpackages.com/badges/darkling-nette-identity-doctrine/health.svg)](https://phpackages.com/packages/darkling-nette-identity-doctrine)
```

###  Alternatives

[majkl578/nette-identity-doctrine

Integration of entities implementing IIdentity in Nette 2

28119.1k](/packages/majkl578-nette-identity-doctrine)[kdyby/doctrine

Doctrine integration into Nette Framework

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

Doctrine ORM for Nette Framework

581.9M37](/packages/nettrine-orm)[nettrine/extensions-atlantic18

Doctrine2 behavioral extensions for Nette Framework

12922.2k3](/packages/nettrine-extensions-atlantic18)

PHPackages © 2026

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