PHPackages                             switon/principal - 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. switon/principal

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

switon/principal
================

Identity and tenant runtime contracts for Switon (standalone)

v1.0.0(1mo ago)0247MITPHPPHP &gt;=8.3CI passing

Since May 10Pushed 1mo agoCompare

[ Source](https://github.com/switon-php/principal)[ Packagist](https://packagist.org/packages/switon/principal)[ Docs](https://github.com/switon-php/principal)[ RSS](/packages/switon-principal/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (2)Versions (2)Used By (7)

Switon Principal Package
========================

[](#switon-principal-package)

Identity and tenant runtime contracts for Switon Framework.

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

[](#installation)

```
composer require switon/principal
```

**Requirements:** PHP 8.3+

Quick Start
-----------

[](#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:

License
-------

[](#license)

MIT.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance94

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

31d ago

### Community

Maintainers

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

---

Top Contributors

[![switon-php](https://avatars.githubusercontent.com/u/247358032?v=4)](https://github.com/switon-php "switon-php (7 commits)")

---

Tags

identityprincipalswitontenantidentitytenantswitonprincipal

### Embed Badge

![Health badge](/badges/switon-principal/health.svg)

```
[![Health](https://phpackages.com/badges/switon-principal/health.svg)](https://phpackages.com/packages/switon-principal)
```

###  Alternatives

[league/oauth2-client

OAuth 2.0 Client Library

3.9k125.2M1.3k](/packages/league-oauth2-client)[league/oauth1-client

OAuth 1.0 Client Library

996106.2M114](/packages/league-oauth1-client)[onelogin/php-saml

PHP SAML Toolkit

1.3k46.5M132](/packages/onelogin-php-saml)[facile-it/php-openid-client

OpenID (OIDC) Client

42641.9k12](/packages/facile-it-php-openid-client)[adam-paterson/oauth2-stripe

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

172.5M4](/packages/adam-paterson-oauth2-stripe)[telesign/telesign

TeleSign SDK

162.1M3](/packages/telesign-telesign)

PHPackages © 2026

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