xp-framework/ldap 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

xp-framework/ldap

最新稳定版本:v9.1.1

Composer 安装命令:

composer require xp-framework/ldap

包简介

LDAP support for the XP Framework

关键字:

README 文档

README

Build status on GitHub XP Framework Module BSD Licence Requires PHP 7.0+ Supports PHP 8.0+ Latest Stable Version

The peer.ldap package implements LDAP (Lighweight Directory Access Protocol) access.

Example (LDAP search)

use peer\ldap\LDAPConnection; use util\cmd\Console; $l= new LDAPConnection('ldap://ldap.example.com'); $l->connect(); $search= $l->search( 'ou=People,dc=OpenLDAP,dc=Org', '(objectClass=*)' ); Console::writeLinef('===> %d entries found', $search->numEntries()); foreach ($search as $result) { Console::writeLine('---> ', $result->toString()); } $l->close();

Example (Modifying an entry)

use peer\ldap\{LDAPConnection, LDAPEntry}; $l= new LDAPConnection('ldap://uid=admin,o=roles,dc=planet-xp,dc=net:password@ldap.example.com'); $l->connect(); with ($entry= $l->read(new LDAPEntry('uid=1549,o=people,dc=planet-xp,dc=net'))); { $entry->setAttribute('firstname', 'Timm'); $l->modify($entry); } $l->close();

Example (Adding an entry)

use peer\ldap\{LDAPConnection, LDAPEntry}; $l= new LDAPConnection('ldap://uid=admin,o=roles,dc=planet-xp,dc=net:password@ldap.example.com'); $l->connect(); with ($entry= new LDAPEntry('uid=1549,o=people,dc=planet-xp,dc=net')); { $entry->setAttribute('uid', 1549); $entry->setAttribute('firstname', 'Timm'); $entry->setAttribute('lastname', 'Friebe'); $entry->setAttribute('objectClass', 'xpPerson'); $l->add($entry); } $l->close();

Dynamically creating LDAP queries

If the LDAP queries need to be constructed dynamically the LDAPQuery class provides a printf-style syntax to do so:

use peer\ldap\LDAPQuery; $res= $ldap->searchBy(new LDAPQuery( 'o=people,dc=planet-xp,dc=net', '(&(objectClass=%c)(|(username=%s)(uid=%d)))', 'xpPerson', 'friebe' 1549 ));

When using the "%s" token, the value passed is escaped according to rules in LDAP query syntax. The %c token copies as-is, and %d handles the argument as numeric value.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固