PHPackages                             yetopen/yii2-usuario-ldap - 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. yetopen/yii2-usuario-ldap

ActiveYii2-extension[Authentication &amp; Authorization](/categories/authentication)

yetopen/yii2-usuario-ldap
=========================

An Yii2 extension to add LDAP auth (and sync) to yii2-usuario

v1.3.13(1y ago)24.3k↓100%4[1 PRs](https://github.com/YetOpen/yii2-usuario-ldap/pulls)GPL-3.0-or-laterPHP

Since Jan 9Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/YetOpen/yii2-usuario-ldap)[ Packagist](https://packagist.org/packages/yetopen/yii2-usuario-ldap)[ RSS](/packages/yetopen-yii2-usuario-ldap/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (4)Versions (23)Used By (0)

Yii2 Usuario LDAP
=================

[](#yii2-usuario-ldap)

An yii2 extension to authenticate and/or syncronize users against LDAP for [2amigos/yii2-usuario](https://github.com/2amigos/yii2-usuario).

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run:

```
php composer.phar require --prefer-dist yetopen/yii2-usuario-ldap "*"

```

or add

```
"yetopen/yii2-usuario-ldap": "*"

```

to the require section of your `composer.json` file.

Configuration
-------------

[](#configuration)

Add in your config (`config/web.php` for the basic app):

```
//...
'bootstrap' => ['log', 'usuarioLdap'],
//...
'components' => [
    //...
    'usuarioLdap' => [
        'class' => 'yetopen\usuarioLdap\UsuarioLdapComponent',
        'ldapConfig' => [
            'hosts' => ['host.example.com'],
            'base_dn' => 'dc=mydomain,dc=local',
            'account_prefix' => 'cn=',
            'account_suffix' => ',ou=Users,dc=mydomain,dc=local',
            'use_ssl' => true,
            'username' => 'bind_username',
            'password' => 'bind_password',
        ],
        'createLocalUsers' => TRUE,
        'defaultRoles' => ['standardUser'],
        'syncUsersToLdap' => TRUE,
        'secondLdapConfig' => [
            'hosts' => ['host.example.com'],
            'base_dn' => 'dc=mydomain,dc=local',
            'account_prefix' => 'cn=',
            'account_suffix' => ',ou=Users,dc=mydomain,dc=local',
            'username' => 'bind_username',
            'password' => 'bind_password',
        ],
        'allowPasswordRecovery' => FALSE,
        'passwordRecoveryRedirect' => ['/controller/action']
    ],
    //...
]
```

adapting parameters to your setup.

#### Configuration options

[](#configuration-options)

- **ldapConfig**: all the parameters for connecting to LDAP server as documented in [Adldap2](https://adldap2.github.io/Adldap2/#/setup?id=options)
- **createLocalUsers**: if TRUE when a user successfully authenticate against the first LDAP server is created locally in Yii database. If FALSE a default users with ID specified in `defaultUserId` is used for the session
- **defaultRoles**: if specified the role/s will be assigned to the users created by the extension. Can be set as an array. Default to FALSE
- **secondLdapConfig**: if specified this is used as LDAP server for sync the local users, if not specified this is equal to *ldapConfig*
- **syncUsersToLdap**: if TRUE changes to local users are synchronized to the second LDAP server. This includes creation and deletion of an user
- **defaultUserId**: if `createLocalUsers` is set to FALSE must contain the ID of an user to be used as local. Defaults to `-1`
- **allowPasswordRecovery**: if TRUE it will enable password recovery process, otherwise it will redirect the LDAP users to the url specified in `passwrdRecoveryRedirect`. Defaults to FALSE.
- **passwordRecoveryRedirect**: when `allowPasswordRecovery` is set to FALSE specifies the URL where the user will be redirected when trying to recover the password. This parameter will be processed by yii\\helpers\\Url::to().
- **logCategory**: it's the log category that will be passed when the module logs something, defaults to *YII2\_USUARIO\_LDAP*

#### Log configuration

[](#log-configuration)

To log all the messages about the module in one single file, configure under `targets` of log config file

```
[
    'class' => 'yii\log\FileTarget', // or another target if you prefer
    // Gets all the log and exceptions messages of the module
    'categories' => [
        'YII2_USUARIO_LDAP',
        'yetopen\usuarioLdap\NoLdapUserException',
        'yetopen\usuarioLdap\LdapConfigurationErrorException',
        'yetopen\usuarioLdap\MultipleUsersFoundException',
        'yetopen\usuarioLdap\RoleNotFoundException',
    ],
    'logFile' => '@runtime/logs/usuario_ldap.log', // or the log file destination that you prefer
]
```

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance52

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~66 days

Total

20

Last Release

538d ago

Major Versions

0.3.5.x-dev → v1.3.32023-02-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a11b10bd765d5709a772c85ead17f8643e15c7cea3ed0ba4660a1cc9032d23a?d=identicon)[maxxer](/maintainers/maxxer)

![](https://www.gravatar.com/avatar/6a00efa7e0d4e4e2eea12617103bb6819687cfe517c3fe5b2bd0addae5fbfd14?d=identicon)[yetopen-stage](/maintainers/yetopen-stage)

![](https://www.gravatar.com/avatar/0544a8c62bb0286fe7f4b507dd7c0a0b851f5d06b71da46c9f9d45e21f05fc31?d=identicon)[yetopen-com](/maintainers/yetopen-com)

---

Top Contributors

[![schmunk42](https://avatars.githubusercontent.com/u/649031?v=4)](https://github.com/schmunk42 "schmunk42 (17 commits)")[![eluhr](https://avatars.githubusercontent.com/u/13000805?v=4)](https://github.com/eluhr "eluhr (12 commits)")[![maxxer](https://avatars.githubusercontent.com/u/240201?v=4)](https://github.com/maxxer "maxxer (3 commits)")[![mp1509](https://avatars.githubusercontent.com/u/8182957?v=4)](https://github.com/mp1509 "mp1509 (3 commits)")[![liviuk2](https://avatars.githubusercontent.com/u/11991766?v=4)](https://github.com/liviuk2 "liviuk2 (2 commits)")[![AndreScara11](https://avatars.githubusercontent.com/u/107261962?v=4)](https://github.com/AndreScara11 "AndreScara11 (1 commits)")[![H-Algabri](https://avatars.githubusercontent.com/u/100204087?v=4)](https://github.com/H-Algabri "H-Algabri (1 commits)")

---

Tags

yii2extensionldapusuario

### Embed Badge

![Health badge](/badges/yetopen-yii2-usuario-ldap/health.svg)

```
[![Health](https://phpackages.com/badges/yetopen-yii2-usuario-ldap/health.svg)](https://phpackages.com/packages/yetopen-yii2-usuario-ldap)
```

###  Alternatives

[edvlerblog/yii2-adldap-module

yii2 Active Directory implementation (wrapper for Adldap2)

51227.3k](/packages/edvlerblog-yii2-adldap-module)[chrmorandi/yii2-ldap

Ldap

1453.1k](/packages/chrmorandi-yii2-ldap)[kakadu-dev/yii2-jwt-auth

Extension provide JWT auth for Yii2

105.8k](/packages/kakadu-dev-yii2-jwt-auth)

PHPackages © 2026

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