PHPackages                             codzo/middleware-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. codzo/middleware-authentication

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

codzo/middleware-authentication
===============================

Slim 4 Middleware for authentication

044PHP

Since Nov 29Pushed 1y ago1 watchersCompare

[ Source](https://github.com/codzo/middleware-authentication)[ Packagist](https://packagist.org/packages/codzo/middleware-authentication)[ RSS](/packages/codzo-middleware-authentication/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Authenticate Through Middleware
===============================

[](#authenticate-through-middleware)

Dependency
----------

[](#dependency)

- Package `codzo/config`

Settings
--------

[](#settings)

Require following settings exposured to `codzo/config`

- `authentication.validator.classname`

    The classname of selected validator. If appointing multiple validators, using a comma to separate class names. The first validator successfully authenticated the use will provide an authentication identifier to app and end the process.

    Provide full class name with namespaces.

    Default value: `Codzo\Middleware\Authentication\Validator\SessionValidator`.
- `authentication.redirect.url`

    The redirect url when authentication failed.

    Default value: `/login`.

See validators for more setting options.

How to authenticate
-------------------

[](#how-to-authenticate)

This middleware will call **validators** to authenticate. A validator implements `IAuthenticationValidator` providing following functions:

- `isAuthenticated(Request $request=null) : bool`

    check if authenticated. If not, redirect to `/Login'
- `getAuthenticationIdentifer() : string`

    get the identifier. See validators for specific data returned.

Validator
---------

[](#validator)

Built-in validators:

### SessionValidator

[](#sessionvalidator)

Validate the data stored in session for authentication.

Settings:

- `authentication.sessionvalidator.session.varname`

    The name of the session data. This is the key name of `$_SESSION` variable.

    Example:

    With setting as of `LOGIN_UUID`, `$_SESSION ['LOGIN__UUID']` will be checked and returned.
- `authentication.sessionvalidator.session.value`

    The pattern of the expected identifier. If session data matches this pattern, current use will be considered as authenticated.

    Example: `.*` to match any string.

###  Health Score

16

—

LowBetter than 4% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity17

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/6d50c4f0fcf0cfd840aee71baebc79f441ea8f3a7bef4406fcd5fba97022d4cd?d=identicon)[neilfan](/maintainers/neilfan)

---

Top Contributors

[![neilfan](https://avatars.githubusercontent.com/u/709968?v=4)](https://github.com/neilfan "neilfan (16 commits)")

### Embed Badge

![Health badge](/badges/codzo-middleware-authentication/health.svg)

```
[![Health](https://phpackages.com/badges/codzo-middleware-authentication/health.svg)](https://phpackages.com/packages/codzo-middleware-authentication)
```

###  Alternatives

[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

761.3M17](/packages/kartik-v-yii2-password)[vitalybaev/laravel5-dkim

Laravel 5/6 package for signing outgoing messages with DKIM.

3163.1k](/packages/vitalybaev-laravel5-dkim)

PHPackages © 2026

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