PHPackages                             rimelek/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. rimelek/ldap-client

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

rimelek/ldap-client
===================

LDAP Client

v1.0.0-alpha.3(7y ago)0201MITPHPPHP &gt;=7.0

Since Jan 23Pushed 7y ago1 watchersCompare

[ Source](https://github.com/rimelek/php-ldap-client)[ Packagist](https://packagist.org/packages/rimelek/ldap-client)[ RSS](/packages/rimelek-ldap-client/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (4)Used By (0)

Description
-----------

[](#description)

Object-oriented LDAP Client written in PHP.

Dependencies:

- PHP &gt;= 7.0
- [ldap extension](http://php.net/manual/en/intro.ldap.php)

Install via composer
--------------------

[](#install-via-composer)

**latest**

```
php composer.phar require rimelek/ldap-client:dev-master
```

**Latest tagged alpha:**

```
php composer.phar require rimelek/ldap-client:1.0.0-alpha.2
```

How to use
----------

[](#how-to-use)

### Create an LDAP instance

[](#create-an-ldap-instance)

First of all, you need an object that knows all the connection data and some options for the native LDAP extension. The options are not required.

```
use Rimelek\LDAPCLient\LDAP;

$ldap = new LDAP();
$ldap->setServer('ldap.domain.tld');
$ldap->setPort(389);  // optional. Default: 389

$ldap->setManagerDn('uid=' . $user->getUsername() . ',ou=people,dc=domain,dc=tld');
$ldap->setPassword($user->getPassword());

$ldap->setScope(LDAP::SCOPE_SUB); // for search (*_ONE | *_BASE | *_SUB)
$ldap->setBaseDn('ou=people,dc=domain,dc=tld'); // for search
```

### Create LDAP filter

[](#create-ldap-filter)

An LDAP filter string follows this syntax:

```
Simplest filter: (key=value)
Multiple filters:
   or: (key1=value1)|(key2>=value)
  and: (key1=value1)&(key2>=value2)
You can also negate it:
       (!((key1=value1)&(key2>=value2)))

```

When you need many filters it can be hard to write. Filters are objects here.

```
use Rimelek\LDAPClient\Filter;
use Rimelek\LDAPClient\OrFIlter;
use Rimelek\LDAPClient\AndFilter;
```

```
/*Simplest filter:*/ $filter = new Filter('key', 'value');
/*Multiple filters:*/
  /*or:*/

  $filter = new OrFilter([
      new Filter('key1', 'value1'),
      new Filter('key2', 'value2', Filter::OP_GREATER_THAN),
  ]);

  /*and:*/

  $filter = new AndFilter([
      new Filter('key1', 'value1'),
      new Filter('key2', 'value2', Filter::OP_GREATER_THAN),
  ]);

/* You can also negate it: */

  $filter = new AndFilter([
      new Filter('key1', 'value1'),
      new Filter('key2', 'value2', Filter::OP_GREATER_THAN),
  ], true);
```

Third argument of Filter is the operator. Here are all of them:

- Filter::OP\_EQUALITY (=)
- Filter::OP\_GREATER\_THAN (&gt;=)
- Filter::OP\_LESS\_THAN (&lt;=)
- Filter::OP\_PROXIMITY (~=)

### Search

[](#search)

```
$result = $ldap->search($filter);
$entries = $result->getEntries();

foreach ($entries as $entry) {
    $attr = $entry->getAttribute();
    echo $attr->getName() . '';
    foreach ($attr as $value) {
        echo  ' - ' . $value . '';
    }
}
```

More information coming soon.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

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

Total

3

Last Release

2736d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8455727?v=4)[Ákos Takács](/maintainers/rimelek)[@rimelek](https://github.com/rimelek)

---

Top Contributors

[![rimelek](https://avatars.githubusercontent.com/u/8455727?v=4)](https://github.com/rimelek "rimelek (9 commits)")

---

Tags

ldap-extensionphp

### Embed Badge

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

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

###  Alternatives

[gijsg/system-resources

A Laravel Nova card.

2981.9k](/packages/gijsg-system-resources)

PHPackages © 2026

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