PHPackages                             tivins/userpack - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. tivins/userpack

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tivins/userpack
===============

User utility pack for web applications

027PHP

Since Apr 1Pushed 4y ago1 watchersCompare

[ Source](https://github.com/tivins/userpack)[ Packagist](https://packagist.org/packages/tivins/userpack)[ RSS](/packages/tivins-userpack/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

UserPack
========

[](#userpack)

User utility pack for web applications

Require:

- PHP 8.1
- tivins/database
- tivins/php-common
- firebase/php-jwt

Example:

```
use Tivins\Database\{Database, Connectors\MySQLConnector};
use Tivins\UserPack\UserModule;

$database = new Database(new MySQLConnector($dbname, $user, $password));
$usermod  = new UserModule($database);
$usermod->install();
$usermod->createUser('admin', 'admin@example.com', 'aStrongPassword');

# Find a user using credentials
$user = $usermod->getByCredentials('admin', 'aStrongPassword');
```

JWT:

```
use Tivins\UserPack\WebToken;
class MyWebToken extends WebToken
{
    public function __construct()
    {
        $this->issuer         = 'my-app.example.com';
        $this->audience       = '';
        $this->privateKeyPath = '/path/to/private-key.pem';
        $this->publicKeyPath  = '/path/to/public-key.pub';
    }
}

// generate a web-token
$webToken = new MyWebToken();
$user     = $usermod->getByCredentials('admin', 'aStrongPassword');
$token    = $webToken->encode(['uid' => $user->id]);

// Authenticate from Authorization header
$webToken = new MyWebToken();
$user     = $usermod->getFromHTTPAuthorization($webToken);
```

### Hooks

[](#hooks)

Example of a custom UserModule class:

```
use Tivins\UserPack\UserModule;
use Tivins\Database\CreateQuery;

class MyUserModule extends UserModule
{
    /**
     * Override the UserModule property to change the table name.
     */
    protected string $tableName = 'custom_user_table';

    /**
     * Alter the user table creation.
     * @see https://github.com/tivins/database#create-query
     */
    public function alterCreateTable(CreateQuery $query) : void
    {
        $query->addString('custom_field')
        ->addInteger('another_field', unsigned: true);
    }
}
```

Session
-------

[](#session)

```
use Tivins\UserPack\UserSession;
UserSession::isAuthenticated(); // bool
UserSession::getID(); // int
UserSession::setID(123);
```

UI
--

[](#ui)

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/13aae62b30274178dfd8d18ce4b6bee1a7d7bcbc9db17c2d22b2be5c7b51edc4?d=identicon)[Tivins](/maintainers/Tivins)

---

Top Contributors

[![tivins](https://avatars.githubusercontent.com/u/479448?v=4)](https://github.com/tivins "tivins (19 commits)")

### Embed Badge

![Health badge](/badges/tivins-userpack/health.svg)

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

PHPackages © 2026

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