PHPackages                             hakuryo/ldap-client - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. hakuryo/ldap-client

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hakuryo/ldap-client
===================

A simple LDAP client with a lot a helper function

2.3.1(10mo ago)0248MITPHPPHP &gt;=8.1.0

Since May 31Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/CaptainClaquette/composer-ldap-client)[ Packagist](https://packagist.org/packages/hakuryo/ldap-client)[ RSS](/packages/hakuryo-ldap-client/feed)WikiDiscussions main Synced 6d ago

READMEChangelogDependencies (2)Versions (12)Used By (0)

Patch Note
----------

[](#patch-note)

### 2.2.0 (breaking change)

[](#220-breaking-change)

#### feature

[](#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

[](#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

[](#fix)

- list function now use pagination as intended

### 2.1.0

[](#210)

- Add pagination param to search function

### 2.0.0 (breaking change)

[](#200-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 =&gt; LDAPSearchException
    - add =&gt; LDAPAddException
    - modify =&gt; LDAPModifyException
    - delete =&gt; LDAPDeleteException
    - fromFile =&gt; LDAPConnectException / LDAPBinDException

#### new function

[](#new-function)

- list perform a single level search to get more performance.

#### modified function

[](#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)

[](#111-breaking-changes)

- Rename `ConnectionLDAP::fromFile` to `ConnectionLDAP::from_file` fit naming convention.

Install
-------

[](#install)

> composer require hakuryo/ldap-client

Dependencies
------------

[](#dependencies)

### Mandatory

[](#mandatory)

- PHP &gt;= 8.1

Features
--------

[](#features)

- Parsing client config from INI and JSON file

Usage &amp; exemples
--------------------

[](#usage--exemples)

### Exemple INI file

[](#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

[](#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);
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance54

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

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

Recently: every ~85 days

Total

9

Last Release

322d ago

Major Versions

1.1.2 → 2.0.02024-07-23

PHP version history (2 changes)1.0.0PHP &gt;=7.0.0

2.0.0PHP &gt;=8.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/482cf0225f97ddd58cb99a0123baeae3aba471ccdbf61904de4c49167af19af2?d=identicon)[Hakuryo](/maintainers/Hakuryo)

---

Top Contributors

[![CaptainClaquette](https://avatars.githubusercontent.com/u/10845062?v=4)](https://github.com/CaptainClaquette "CaptainClaquette (15 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hakuryo-ldap-client/health.svg)

```
[![Health](https://phpackages.com/badges/hakuryo-ldap-client/health.svg)](https://phpackages.com/packages/hakuryo-ldap-client)
```

###  Alternatives

[ajbdev/cronlingo

Express crontabs as human readable phrases

14651.4k](/packages/ajbdev-cronlingo)[cytopia/awesome-ci

Lot's of tools for git, file and static source code analysis.

3386.4k](/packages/cytopia-awesome-ci)[vich/geographical-bundle

Geographical functionality for ORM and ODM entities and JavaScript maps rendering

10428.0k](/packages/vich-geographical-bundle)

PHPackages © 2026

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