PHPackages                             klsoft/yii3-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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. klsoft/yii3-user

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

klsoft/yii3-user
================

The package provides an implementation of the AuthenticationMethodInterface that allows redirection to a protected route after successful authentication

1.1.0(2mo ago)028↓66.7%2MITPHPPHP &gt;=8.1

Since Feb 19Pushed 2mo agoCompare

[ Source](https://github.com/klsoft-web/yii3-user)[ Packagist](https://packagist.org/packages/klsoft/yii3-user)[ Docs](https://github.com/klsoft-web/yii3-user)[ RSS](/packages/klsoft-yii3-user/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (3)Used By (2)

YII3-USER
=========

[](#yii3-user)

The package provides an implementation of the AuthenticationMethodInterface that allows redirection to a protected route after successful authentication. It also releases the CookieLogin class with the extends method withCookieSecure(), which allows you to configure CookieLogin for an HTTP connection.

Requirement
-----------

[](#requirement)

- PHP 8.1 or higher.

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

[](#installation)

```
composer require klsoft/yii3-user
```

How to use
----------

[](#how-to-use)

First, protect the route:

```
use Klsoft\Yii3Auth\Middleware\Authentication;

Route::post('/create')
        ->middleware(Authentication::class)
        ->action([SiteController::class, 'create'])
        ->name('site/create')
```

Then, within the login action:

```
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ResponseFactoryInterface;
use Yiisoft\User\CurrentUser;

public function login(ServerRequestInterface $request): ResponseInterface
{
    // ...
    //After a successful authentication $this->currentUser->login($identity)
    $queryParams = $request->getQueryParams();
    if(isset($queryParams['redirect_uri'])) {
        return $this->responseFactory
            ->createResponse(Status::FOUND)
            ->withHeader('Location', $queryParams['redirect_uri']);
    }
}
```

Example configuration for CookieLogin for an HTTP connection:

```
use DateInterval;
use Klsoft\Yii3User\Login\Cookie\CookieLogin;

return [
    // ...
    CookieLogin::class => [
        '__construct()' => [
            'duration' => $params['yiisoft/user']['cookieLogin']['duration'] !== null ?
                new DateInterval($params['yiisoft/user']['cookieLogin']['duration']) :
                null,
        ],
        'withCookieSecure()' => [false]
    ],
];
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance86

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity44

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 ~17 days

Total

2

Last Release

70d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f4e8ac50e4ad22be84b07f4c06d28cf280d22f689c460cd385c556727e638827?d=identicon)[klsoft-web](/maintainers/klsoft-web)

---

Top Contributors

[![klsoft-web](https://avatars.githubusercontent.com/u/7967163?v=4)](https://github.com/klsoft-web "klsoft-web (3 commits)")

---

Tags

Authenticationuseryii3

### Embed Badge

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

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

###  Alternatives

[amnah/yii2-user

Yii 2 user authentication module

252225.7k3](/packages/amnah-yii2-user)[lab404/laravel-auth-checker

Laravel Auth Checker allows you to log users authentication, devices authenticated from and lock intrusions.

223164.9k2](/packages/lab404-laravel-auth-checker)[oryzone/oauth-user-data

Extension library for Lusitanian/PHPoAuthLib to extract user profile data from various oAuth providers

4558.6k](/packages/oryzone-oauth-user-data)[sarav/laravel-multiauth

A Simple Laravel Package for handling multiple authentication

5030.7k](/packages/sarav-laravel-multiauth)[winter/wn-user-plugin

User plugin for Winter CMS

1233.5k13](/packages/winter-wn-user-plugin)[asgardcms/user-module

User module for AsgardCMS. Handles the authentication and authorisation as well as the user management.

1129.5k2](/packages/asgardcms-user-module)

PHPackages © 2026

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