switon / principal
Identity and tenant runtime contracts for Switon (standalone)
v1.0.0
2026-05-10 01:54 UTC
Requires
- php: >=8.3
- switon/core: ^1.0
Requires (Dev)
- switon/testing: ^1.0
README
Identity and tenant runtime contracts for Switon Framework.
Installation
composer require switon/principal
Requirements: PHP 8.3+
Quick Start
namespace App\Controller; use Switon\Core\Attribute\Autowired; use Switon\Principal\IdentityInterface; use Switon\Principal\TenantInterface; class ProfileController { #[Autowired] protected IdentityInterface $identity; #[Autowired] protected TenantInterface $tenant; public function indexAction(): array { return [ 'user_id' => $this->identity->isGuest() ? null : $this->identity->getId(), 'tenant' => $this->tenant->hasTenant() ? $this->tenant->getCode() : null, ]; } }
Docs: https://docs.switon.dev/latest/principal
License
MIT.