PHPackages                             piko/user - 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. piko/user

ActiveLibrary

piko/user
=========

A lightweight user session manager to login/logout and retrieve user identity.

v2.0.1(3y ago)073LGPL-3.0-or-laterPHPPHP &gt;=7.1.0

Since Sep 25Pushed 3y ago1 watchersCompare

[ Source](https://github.com/piko-framework/user)[ Packagist](https://packagist.org/packages/piko/user)[ Docs](https://github.com/piko-framework/user)[ RSS](/packages/piko-user/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (4)Versions (5)Used By (0)

Piko User
=========

[](#piko-user)

[![build](https://github.com/piko-framework/user/actions/workflows/php.yml/badge.svg)](https://github.com/piko-framework/user/actions/workflows/php.yml)[![Coverage Status](https://camo.githubusercontent.com/f5c35e3bbb156308d189081cec05d85d28e26d64ddb7ea661d24208c42e8224a/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f70696b6f2d6672616d65776f726b2f757365722f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/piko-framework/user?branch=main)

A lightweight user session manager to login/logout, check permissions and retrieve user identity between sessions.

Installation
============

[](#installation)

It's recommended that you use Composer to install Piko User.

```
composer require piko/user
```

Usage
=====

[](#usage)

Basic exemple:

```
require 'vendor/autoload.php';

use Piko\User;
use Piko\User\IdentityInterface;

// Define first your user identity class
class Identity implements IdentityInterface
{
    private static $users = [
        1 => 'paul',
        2 => 'pierre',
    ];

    public $id;
    public $username;

    public static function findIdentity($id)
    {
        if (isset(static::$users[$id])) {
            $user = new static();
            $user->id = $id;
            $user->username = static::$users[$id];

            return $user;
        }

        return null;
    }

    public function getId()
    {
        return $this->id;
    }
}

$user = new User([
    'identityClass' => Identity::class,
    'checkAccess' => function($id, $permission) {
        return $id == 1 && $permission == 'test';
    }
]);

// Login

$user->login(Identity::findIdentity(1));

if (!$user->isGuest()) {
    echo $user->getIdentity()->username; // paul
}

if ($user->can('test')) {
    echo 'I can test';
}

$user->logout();

if ($user->isGuest()) {
    var_dump($user->getIdentity()); // null
    echo 'Not Authenticated';
}

if (!$user->can('test')) {
    echo 'I cannot test';
}
```

Advanced example: [See UserTest.php](tests/UserTest.php)

###  Health Score

23

—

LowBetter than 30% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

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

Every ~135 days

Total

4

Last Release

1233d ago

Major Versions

v1.1 → v2.02022-11-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/001b70c85d853a2aae5f1bf74a1ff7ad77ffcec2d423090d67293bde99158350?d=identicon)[ilhooq](/maintainers/ilhooq)

---

Top Contributors

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

---

Tags

usersessionloginlogoutpiko

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/piko-user/health.svg)

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

###  Alternatives

[sandstorm/usermanagement

Neos and Flow package for user management, login/logout, password reset and user activation

3928.3k](/packages/sandstorm-usermanagement)[codeconsortium/ccdn-user-security-bundle

CCDN User Security Bundle

59100.7k](/packages/codeconsortium-ccdn-user-security-bundle)[sarav/laravel-multiauth

A Simple Laravel Package for handling multiple authentication

5530.6k](/packages/sarav-laravel-multiauth)[gburtini/acl

Dependency free, simple access control lists for PHP.

3610.4k](/packages/gburtini-acl)[karriere/state

Laravel package for storing current application state in cache/session

1718.2k](/packages/karriere-state)[alajusticia/laravel-logins

Sessions and Sanctum tokens tracking in Laravel apps, users notification on new login, multiple remember tokens, IP geolocation, User-Agent parser

1910.3k](/packages/alajusticia-laravel-logins)

PHPackages © 2026

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