PHPackages                             linkorb/flex-auth - 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. linkorb/flex-auth

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

linkorb/flex-auth
=================

This libraries provides flex auth for symfony security in runtime

v1.5.1(3y ago)01.2k23MITPHPPHP &gt;=7.0

Since Mar 8Pushed 3y ago2 watchersCompare

[ Source](https://github.com/linkorb/flex-auth)[ Packagist](https://packagist.org/packages/linkorb/flex-auth)[ RSS](/packages/linkorb-flex-auth/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (2)Versions (12)Used By (3)

flexauth
========

[](#flexauth)

FlexAuth: independent library for symfony security

Allows switching the `UserProvider` at Runtime using environment variables.

Dynamic UserProvider that supports multiple backends based on environment variables.

To override which should provider configuration as array for runtime `FlexAuth\FlexAuthTypeProviderInterface`

Using `FlexAuth\FlexAuthTypeProviderFactory::fromEnv('FLEX_AUTH'')` and define env variables in format `type?param1=value1&param2=value2&param3=value3`

Example define environment variable

```
## Use memory provider
FLEX_AUTH=memory?users=alice:4l1c3:ROLE_ADMIN;ROLE_EXAMPLE,bob:b0b:ROLE_EXAMPLE)
## Or use userbase provider
FLEX_AUTH=userbase?dsn=https://username:password@userbase.example.com
## Or use the entity provider
FLEX_AUTH=entity?class=\App\Entities\User&property=username
## Or use a JWT provider
FLEX_AUTH=jwt?algo=RS256&publickey=@\cert\public_key.key&private_key=@\cert\privite_key.key&userField=username&groupField=permissions

```

A long form format could be supported like this:

```
FLEX_AUTH=entity
FLEX_AUTH_ENTITY_CLASS=\App\Entities\User
FLEX_AUTH_ENTITY_PROPERTY=username

```

Dynamically flex type provider example.

```
class MyFlexAuthTypeProvider implements FlexAuthTypeProviderInterface {
    protected $className = \App\Entities\User::class; // can be change in runtime
    protected $propery = 'id';

    //...
    public function provide(): array { // will be call every time
        return [
            'type' => 'entity',
            'class' => $this->className,
            'propery' => $this->propery, // dynamic user identificator
        ];
    }

    public function switchToEmail() {
        $this->propery = 'email';
    }
}
```

Full working example you can see `/test/AuthenticationTest::testAuthenticate`

Run tests

```
./vendor/bin/phpunit --bootstrap vendor/autoload.php tests/

```

### Links

[](#links)

[FlexAuthBundle - symfony bundle](https://github.com/linkorb/flex-auth-bundle). [Demo](https://github.com/linkorb/flex-auth-bundle-demo)

[FlexAuthProvider - silex provider](https://github.com/linkorb/flex-auth-provider). [Demo](https://github.com/linkorb/flex-auth-provider-demo)

[The Security Component(Symfony Docs)](https://symfony.com/doc/current/components/security.html)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 55.2% 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 ~178 days

Recently: every ~350 days

Total

9

Last Release

1200d ago

PHP version history (2 changes)v1.0.0PHP ^7.0

v1.5.1PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1db66b320db18b8036ea68211b7d8a39e7c6da97e6fd29f59a50380ebb69d0bb?d=identicon)[joostfaassen](/maintainers/joostfaassen)

---

Top Contributors

[![sashaaro](https://avatars.githubusercontent.com/u/5504250?v=4)](https://github.com/sashaaro "sashaaro (16 commits)")[![joostfaassen](https://avatars.githubusercontent.com/u/411113?v=4)](https://github.com/joostfaassen "joostfaassen (12 commits)")[![prajapati-kaushik](https://avatars.githubusercontent.com/u/10140681?v=4)](https://github.com/prajapati-kaushik "prajapati-kaushik (1 commits)")

---

Tags

auth

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/linkorb-flex-auth/health.svg)

```
[![Health](https://phpackages.com/badges/linkorb-flex-auth/health.svg)](https://phpackages.com/packages/linkorb-flex-auth)
```

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[league/oauth2-server

A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.

6.6k136.0M248](/packages/league-oauth2-server)[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k16.4M48](/packages/lab404-laravel-impersonate)[auth0/auth0-php

PHP SDK for Auth0 Authentication and Management APIs.

40820.2M68](/packages/auth0-auth0-php)[kreait/firebase-tokens

A library to work with Firebase tokens

24040.8M14](/packages/kreait-firebase-tokens)

PHPackages © 2026

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