PHPackages                             sinevia/php-library-authentication - 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. sinevia/php-library-authentication

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

sinevia/php-library-authentication
==================================

PHP Library Authentication

v1.1.0(2y ago)0570proprietaryPHP

Since Jan 4Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Sinevia/php-library-authentication)[ Packagist](https://packagist.org/packages/sinevia/php-library-authentication)[ Docs](http://github.com/sinevia/php-library-authentication)[ RSS](/packages/sinevia-php-library-authentication/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (5)DependenciesVersions (6)Used By (0)

PHP Library Authenticaton
=========================

[](#php-library-authenticaton)

Authenticaton classes

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

[](#installation)

Install using composer

```
composer require sinevia/php-library-authentication

```

Usage
-----

[](#usage)

### 1. Identity management

[](#1-identity-management)

The Authentication class helps you reliably keep the authenticated users during the current session.

```
\Sinevia\Authentication::getInstance()->setIdentity('user', $loggedinUser->Id); // After successful login
$userId = \Sinevia\Authentication::getInstance()->getIdentity('user'); // During session
\Sinevia\Authentication::getInstance()->reoveIdentity('user'); // On logout

```

### 2. Namespaced Identities

[](#2-namespaced-identities)

Probably the greatest features is the support of namespaces. The namespaces allows to keep separation betweern different areas of responsibility. The following example will help illustrate the namespaces better. A website may be separated into manager area, clients area, employee area, each with different functions. Upon login a manager can be set to authenticated both as a manager and employee (example 1). Upon attempting to access the area his access can be checked before being allowed/denied to continue (example 2).

Example 1. Add the current user both to the manager and employee namespace

```
if ($isManager) {
    \Sinevia\Authentication::getInstance()->setIdentity('manager', $loggedinUser->Id);
}
if ($isEmployee) {
    \Sinevia\Authentication::getInstance()->setIdentity('employee', $loggedinUser->Id);
}

```

Example 2. Check if user is allowed access to the manager area and allow/deny access

```
// Check if the user is part of the manager namespace
$managerId = \Sinevia\Authentication::getInstance()->getIdentity('manager');

// Check if user cannot access the manager access
$cannotAccessManagerArea = is_null($managerId);

// Deny access to manager area
if (cannotAccessManagerArea) {
    die('Only managers are allowed access to the manager area');
}

```

In practice you may like to create a helper class to help with keeping the authentication process more readable

```
class Auth {

    /**
     * Returns the user authenticated to a namespace
     * @param string $namespace
     * @return \App\Models\Users\User
     */
    public static function getUser($namespace) {
        return \Sinevia\Authentication::getInstance()->getIdentity($namespace);
    }

    /**
     * Sets the authenticated user to a namespace
     * @param string $namespace
     * @param \App\Models\Users\User $user
     * @return void
     */
    public static function setUser($namespace, $user) {
        return \Sinevia\Authentication::getInstance()->setIdentity($namespace, $user);
    }

    /**
     * Removes the user from a namespace
     * @param string $namespace
     * @return void
     */
    public static function removeUser($namespace) {
        return \Sinevia\Authentication::getInstance()->emptyIdentity($namespace);
    }
}

```

Then use it like:

```
$managerId = Auth::getUser('manager');

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

 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

Every ~531 days

Total

5

Last Release

930d ago

### Community

Maintainers

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

---

Top Contributors

[![Sinevia](https://avatars.githubusercontent.com/u/3450815?v=4)](https://github.com/Sinevia "Sinevia (14 commits)")

---

Tags

phpAuthenticationlibrarysinevia

### Embed Badge

![Health badge](/badges/sinevia-php-library-authentication/health.svg)

```
[![Health](https://phpackages.com/badges/sinevia-php-library-authentication/health.svg)](https://phpackages.com/packages/sinevia-php-library-authentication)
```

###  Alternatives

[kinde-oss/kinde-auth-php

Kinde PHP SDK for authentication

2369.5k3](/packages/kinde-oss-kinde-auth-php)

PHPackages © 2026

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