定制 mauriliobmartins/yii2-ldap-php8 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mauriliobmartins/yii2-ldap-php8

最新稳定版本:1.0.0

Composer 安装命令:

composer require mauriliobmartins/yii2-ldap-php8

包简介

Authorize, search users, get user groups and more from LDAP in Yii2

README 文档

README

This is a fork of the original package created by Vadim E. Kosoukhov, updated to be compatible with PHP 8.

📦 About

The original package was no longer maintained and did not support PHP 8. This fork updates the codebase to ensure full compatibility with modern PHP versions, while preserving the functionality and spirit of the original implementation.

✅ Modifications

The following updates were made in this fork:

  • Updated syntax to support PHP 8
  • Replaced deprecated functions and features
  • Basic testing for PHP 8 compatibility

⚖ License

This project is licensed under the MIT License.

Authorize, search users, get user groups and other from LDAP

Yii2 Latest Stable Version Total Downloads Latest Unstable Version License

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist mauriliobmartins/yii2-ldap-php8

or add

"mauriliobmartins/yii2-ldap-php8": "*"

to the require section of your composer.json file.

Application configuration example:

In config/main.php add:

return [
    'components' => [
        'ldap' => [
            'class' => 'mauriliobmartins\ldap\Connector',
            'useCache' => YII_ENV_DEV ? false : true,
        ],
    ],
    // ...
];

In config/main-local.php add:

return [
    'components' => [
        'ldap' => [
            'host' => 'ldap.example.com',
            'port' => '389',
            'baseDN' => 'OU=...,DC=...,DC=...,DC=net',
            'userDN' => '@....corp.net',
            'groupDN' => '',
            //Input your AD login/pass on dev or sys login/pass on test/prod servers
            'sysUserLogin' => '',
            'sysUserPassword' => '',
        ],
    ],
    // ...
];

Usage example:

if (!Yii::$app->ldap->validateUserCredentials('SAMAccountName', 'password')) {
    throw new ErrorException('Incorrect username or password.');
}
echo Yii::$app->ldap->getUserAttributesBySAMAccountName('SAMAccountName', ['mail', 'sn', 'givenname', 'middlename']);
echo mauriliobmartins\ldap\widgets\UserImage::widget([
    'login' => Yii::$app->user->identity->username,
    'options' => [
        'class' => 'img-circle',
        'alt' => 'User Image',
    ]
]);

统计信息

  • 总下载量: 42
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-10