PHPackages                             nohnaimer/yii2-ldaprecord - 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. nohnaimer/yii2-ldaprecord

ActiveYii2-extension

nohnaimer/yii2-ldaprecord
=========================

Yii2 extension for library LdapRecord

0.3.1(2y ago)1189↓50%1BSD-3-ClausePHPPHP &gt;=8.1

Since Apr 6Pushed 2y ago1 watchersCompare

[ Source](https://github.com/nohnaimer/yii2-ldaprecord)[ Packagist](https://packagist.org/packages/nohnaimer/yii2-ldaprecord)[ Docs](https://github.com/nohnaimer/yii2-ldaprecord)[ RSS](/packages/nohnaimer-yii2-ldaprecord/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (18)Used By (0)

Yii2 LdapRecord extension
=========================

[](#yii2-ldaprecord-extension)

[![Latest Stable Version](https://camo.githubusercontent.com/e92cd39805aa6290f909650baf35aa9a9fe5f67d8db302456c93148cea8e6e2f/68747470733a2f2f706f7365722e707567782e6f72672f6e6f686e61696d65722f796969322d6c6461707265636f72642f762f737461626c65)](https://packagist.org/packages/nohnaimer/yii2-ldaprecord)[![License](https://camo.githubusercontent.com/5ac2347525e29c01a6c857f20610e621d12f937fdfbbaf7218183c5dba33b7e5/68747470733a2f2f706f7365722e707567782e6f72672f6e6f686e61696d65722f796969322d6c6461707265636f72642f6c6963656e7365)](https://packagist.org/packages/nohnaimer/yii2-ldaprecord)[![Total Downloads](https://camo.githubusercontent.com/c12a4ac3bbe8ee6d3ffab6d6594baf3e09f176d4d148162da25148a277fcef25/68747470733a2f2f706f7365722e707567782e6f72672f6e6f686e61696d65722f796969322d6c6461707265636f72642f646f776e6c6f616473)](https://packagist.org/packages/nohnaimer/yii2-ldaprecord)

[Documentation](https://ldaprecord.com/docs/) for LdapRecord

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

[](#installation)

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

```
php composer.phar require --prefer-dist nohnaimer/yii2-ldaprecord "*"

```

or add

```
"nohnaimer/yii2-ldaprecord": "*"

```

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

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

[](#configuration)

```
'components' => [
...
'ldap' => [
            'class' => nohnaimer\ldaprecord\LdapRecord::class,
            'providers' => [
                'ad' => [
                    'class' => nohnaimer\ldaprecord\LdapRecord::class,
                     // Mandatory Configuration Options
                     'hosts'            => ['192.168.1.1'],
                     'base_dn'          => 'dc=local,dc=com',
                     'username'         => 'admin@local.com',
                     'password'         => 'password',

                     // Optional Configuration Options
                     'port'             => 389,
                     'follow_referrals' => false,
                     'use_ssl'          => false,
                     'use_tls'          => false,
                     'version'          => 3,
                     'timeout'          => 5,

                     // Custom LDAP Options
                     'options' => [
                         // See: http://php.net/ldap_set_option
                         LDAP_OPT_X_TLS_REQUIRE_CERT => LDAP_OPT_X_TLS_HARD
                     ],
                ],
                'ldap' => [
                    'hosts' => ['192.168.1.2'],
                    'base_dn' => 'dc=local,dc=com',
                    'username' => 'cn=admin,dc=mts,dc=by',
                    'password' => 'password',

                    // Optional Configuration Options
                    'port' => 389,
                    'version' => 3,

                    // Custom LDAP Options
                    'options' => [
                        // See: http://php.net/ldap_set_option
                        LDAP_OPT_X_TLS_REQUIRE_CERT => LDAP_OPT_X_TLS_HARD
                    ],
                ],
            ],
        ],
...
],
```

Usage
-----

[](#usage)

Simple usage without a user model

Query:

```
Yii::$app->ldap->initProvider('ad')->query()->where('cn', '=', 'John Doe')->get();
```

Authentication:

```
Yii::$app->ldap->initProvider('ad')->auth()->attempt('username', 'password', true);
```

Simple usage with a model

Model:

```
class User extends \LdapRecord\Models\ActiveDirectory\User
{
    /**
     * The "booting" method of the model.
     * @throws \LdapRecord\Auth\BindException
     * @throws \LdapRecord\ConnectionException
     */
    protected static function boot()
    {
        Yii::$app->ldap->initProvider('ad');
    }

    protected $connection = 'ad';
}
```

```
$user = User::findByGuid('guid');
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Recently: every ~147 days

Total

17

Last Release

1036d ago

PHP version history (4 changes)0.0.1PHP &gt;=5.5.0

0.2.2PHP &gt;=7.2

0.2.8PHP &gt;=8.0

0.3.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c0b6415ee49d051979bc8aa20ef52e654a9598b9091db92646dbc802a82700c?d=identicon)[nohnaimer](/maintainers/nohnaimer)

---

Top Contributors

[![nohnaimer](https://avatars.githubusercontent.com/u/8865830?v=4)](https://github.com/nohnaimer "nohnaimer (28 commits)")

---

Tags

yii2extensionldapactive directoryopenldapldaprecord

### Embed Badge

![Health badge](/badges/nohnaimer-yii2-ldaprecord/health.svg)

```
[![Health](https://phpackages.com/badges/nohnaimer-yii2-ldaprecord/health.svg)](https://phpackages.com/packages/nohnaimer-yii2-ldaprecord)
```

###  Alternatives

[chrmorandi/yii2-ldap

Ldap

1453.1k](/packages/chrmorandi-yii2-ldap)[ldaptools/ldaptools

LdapTools is a feature-rich LDAP library for PHP 5.6+.

204263.9k1](/packages/ldaptools-ldaptools)[edvlerblog/yii2-adldap-module

yii2 Active Directory implementation (wrapper for Adldap2)

51227.3k](/packages/edvlerblog-yii2-adldap-module)[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13825.6k47](/packages/skeeks-cms)[causal/ig_ldap_sso_auth

This extension provides LDAP support for TYPO3 by delegating the authentication of frontend and/or backend users to the centrally-managed directory of your organization. It fully supports OpenLDAP and Active Directory and is capable of connecting securely to the authentication server using either TLS or SSL (ldaps://). In case of use in an intranet environment, this extension is a perfect match since it natively brings Single Sign-On (SSO) capability to TYPO3 without any complex configuration.

33377.4k](/packages/causal-ig-ldap-sso-auth)[ldaptools/ldaptools-bundle

Provides easy LDAP integration for Symfony via LdapTools.

49159.5k](/packages/ldaptools-ldaptools-bundle)

PHPackages © 2026

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