drago-ex/project-user
最新稳定版本:v1.0.1
Composer 安装命令:
composer require drago-ex/project-user
包简介
A small helper package for working with the authenticated user in Drago project.
README 文档
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.
Requirements
- PHP >= 8.3
- Nette Framework
- Drago Project core packages
Installation
composer require drago-ex/project-user
Examples
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.
统计信息
- 总下载量: 73
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-25