PHPackages                             jakubstach/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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. jakubstach/nette-identity-doctrine

ActiveNette-addon[Authentication &amp; Authorization](/categories/authentication)

jakubstach/nette-identity-doctrine
==================================

Integration of entities implementing IIdentity in Nette 3

0185PHP

Since Nov 1Pushed 3y agoCompare

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

READMEChangelogDependenciesVersions (1)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.1+
- 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

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 Bus Factor1

Top contributor holds 72% 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://www.gravatar.com/avatar/288a5560bd73ed45cbaa7bf4e35f45e2e49fadfbaf7e9fc96a73fa4e7e5f1ae8?d=identicon)[Jakub Stach](/maintainers/Jakub%20Stach)

---

Top Contributors

[![Majkl578](https://avatars.githubusercontent.com/u/144181?v=4)](https://github.com/Majkl578 "Majkl578 (18 commits)")[![TomasVotruba](https://avatars.githubusercontent.com/u/924196?v=4)](https://github.com/TomasVotruba "TomasVotruba (5 commits)")[![fprochazka](https://avatars.githubusercontent.com/u/158625?v=4)](https://github.com/fprochazka "fprochazka (1 commits)")[![jakubstach](https://avatars.githubusercontent.com/u/18560380?v=4)](https://github.com/jakubstach "jakubstach (1 commits)")

### Embed Badge

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

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

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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