hakuryo/ldap-client
Composer 安装命令:
composer require hakuryo/ldap-client
包简介
A simple LDAP client with a lot a helper function
README 文档
README
2.2.0 (breaking change)
feature
- Add trackBy param to search and list function. This param will replace the auto index key of the array by the value of the key for the corresponding line.
exemple:
$ldap = ConnectionLDAP::fromFile("my_file",'ldap'); $res = $ldap->search(filter:"objectClass=person",trackBy:"mail"); print_r($res); // Will ouptut something like this with uid= toto32 sn=toto and mail=toto@domaine.fr Array ( ["toto@domaine.fr"] => stdClass Object ( [uid] => toto32 [sn] => toto [mail] => toto@domaine.fr ) )
- Add Callback param to search,list and get function to act on lines when they are read.
change
- Param returnedAttrs of search,list and get function now accept a comma separated list of attribute name.
- returnedAttrs keys now respect schema description. They are no longer converted to lowercase.
- before : objectclass
- after : objectClass
- Autloading is now PSR-4 instead of classmap.
- Changed the namespace of Exception classes to be PSR-4 compliant
- Removed ConfigParser class using hakuryo/config-parser instead
fix
- list function now use pagination as intended
2.1.0
- Add pagination param to search function
2.0.0 (breaking change)
- cleaned unused code
- refactoring project, classes moved in new directory / namespace
- Naming convention is now camelCase
- getEntry now return null if no result instead of stdclass
- Ldap operation now throw specifique errors
- search / list / getEntry => LDAPSearchException
- add => LDAPAddException
- modify => LDAPModifyException
- delete => LDAPDeleteException
- fromFile => LDAPConnectException / LDAPBinDException
new function
- list perform a single level search to get more performance.
modified function
- search now perform a subtree search event if scope is one_level.
- getEntry perform a search taking account of scope
1.1.1 (Breaking changes)
- Rename
ConnectionLDAP::fromFiletoConnectionLDAP::from_filefit naming convention.
Install
composer require hakuryo/ldap-client
Dependencies
Mandatory
- PHP >= 8.1
Features
- Parsing client config from INI and JSON file
Usage & exemples
Exemple INI file
[ldap] HOST="ldap://myldap.mydomain.com" ;LDAPS ;HOST="ldaps://myldap.mydomain.com" USER="cn=admin,dc=mydomain, dc=com" DN="dc=mydomain, dc=com" PWD="my_super_secure_password" ;OPTIONAL ;network_timeout in second TIMEOUT=5
ConnectionLDAP usage
require_once './vendor/autoload.php'; use hakuryo\ldap\ConnectionLDAP; // Basic connection $ldap = new ConnectionLDAP("myldap.mydomain.com","uid=user,ou=people,dc=mydomain,dc=com") // From File $ldap = ConnectionLDAP::fromFile("path_to_my_ldap_ini_file"); // You can specify a section of your ini file $ldap = ConnectionLDAP::fromFile("path_to_my_ldap_ini_file","ldap_section"); //ldap_search $ldapFilter = "memberof=cn=admin,ou=groups,dc=mydomain,dc=com"; $attrList = ["uid","displayname","sn","givenname"]; $results = $ldap->search($ldapFilter,$attrList); foreach($result as $entry){ echo json_encode($entry,JSON_PRETTY_PRINT); } // get an specifique entry $ldap->getEntry($ldapFilter,$attrList); // Modify serach_options $ldap->getSearchOptions()->setBaseDN("ou=my_ou,dc=exemple,dc=com"); $ldap->getSearchOptions()->setResultLimit(1); $ldap->getSearchOptions()->setScope(LdapSearchOptions::SEARCH_SCOPE_ONE_LEVEL); // You can chain modification $ldap->getSearchOptions()->setResultLimit(1)->setScope(LdapSearchOptions::SEARCH_SCOPE_ONE_LEVEL);
hakuryo/ldap-client 适用场景与选型建议
hakuryo/ldap-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 259 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 05 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 hakuryo/ldap-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hakuryo/ldap-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 259
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-05-31