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)0732LGPL-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 1mo ago

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

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 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community11

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

1282d 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

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

CCDN User Security Bundle

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

A Simple Laravel Package for handling multiple authentication

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

Dependency free, simple access control lists for PHP.

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

Laravel package for storing current application state in cache/session

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

Session management in Laravel apps, user notifications on new access, support for multiple separate remember tokens, IP geolocation, User-Agent parser

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

PHPackages © 2026

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