drago-ex/project-user

A small helper package for working with the authenticated user in Drago project.

Installs: 56

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:drago-project-resource

pkg:composer/drago-ex/project-user

v1.0.1 2026-01-10 07:14 UTC

This package is auto-updated.

Last update: 2026-01-11 08:51:08 UTC


README

A small helper package for working with the authenticated user in Drago project. Provides type-safe access to identity data and a simple, extensible user identity object.

License: MIT PHP version Coding Style

Requirements

  • PHP >= 8.3
  • Nette Framework
  • Drago Project core packages

Install

composer require drago-ex/project-user

Usage

Injecting the user service:

use App\Core\User\UserAccess;
use Nette\DI\Attributes\Inject;

final class SomePresenter extends Presenter
{
	#[Inject]
	public UserAccess $userAccess;

	protected function beforeRender(): void
	{
		parent::beforeRender();
		$this->template->userAccess = $this->userAccess;
	}
}

Identity data in latte

{varType App\Core\User\UserAccess $userAccess}
{block content}
	<p>{$userAccess->getUserIdentity()->username}</p>
{/block}

User identity object

For common identity fields, use the typed UserIdentity object:

$identity = $userAccess->getUserIdentity();

echo $identity->username;
echo $identity->email;

The UserIdentity class is intentionally simple and can be extended with additional attributes (e.g. id, roles, permissions) as needed.

UserIdentityException is thrown when identity data is missing or invalid.

Notes

  • This package does not handle authentication or authorization.
  • Focused only on safe and convenient access to user identity data.