PHPackages                             dreamscapes/ldap-core - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. dreamscapes/ldap-core

AbandonedArchivedLibrary[Testing &amp; Quality](/categories/testing)

dreamscapes/ldap-core
=====================

Object encapsulation of PHP's native ldap functions

3.1.1(7y ago)1089.4k↑129.3%1[2 issues](https://github.com/Dreamscapes/Ldap-Core/issues)1BSD-3-ClausePHPPHP &gt;=5.4.0

Since Apr 14Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Dreamscapes/Ldap-Core)[ Packagist](https://packagist.org/packages/dreamscapes/ldap-core)[ RSS](/packages/dreamscapes-ldap-core/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (9)Dependencies (2)Versions (11)Used By (1)

Ldap Core
=========

[](#ldap-core)

[![Build Status](https://camo.githubusercontent.com/00fce8d58be9d1396e4fbb034ad26622457a652a1e0868889fc0eab0ad655ca5/68747470733a2f2f7472617669732d63692e6f72672f447265616d7363617065732f4c6461702d436f72652e737667)](https://travis-ci.org/Dreamscapes/Ldap-Core)[![Built with GNU Make](https://camo.githubusercontent.com/733e0772a8e294ac74209acd977d00add7736f4a6b1dc872da2b3f374d465c9f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c74253230776974682d474e552532304d616b652d627269676874677265656e2e737667)](https://camo.githubusercontent.com/733e0772a8e294ac74209acd977d00add7736f4a6b1dc872da2b3f374d465c9f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c74253230776974682d474e552532304d616b652d627269676874677265656e2e737667)

> Object-oriented implementation of PHP's native ldap functions

About
-----

[](#about)

This small library provides access to ldap functions in a nice, object-oriented implementation.

Its purpose is not to provide *fancy extra* functionality for ldap interaction, but only to provide an object-level encapsulation around native PHP functions in a way that makes sense for OOP world. As such, this library is intended either for those who prefer OOP programming style, for those who want to be able to **test** their ldap interaction or for those who would like to write their own libraries which provide that *fancy extra* functionality.

Installation
------------

[](#installation)

### Requirements

[](#requirements)

- PHP 5.4 and newer with LDAP support ([setup instructions](http://www.php.net/manual/en/ldap.installation.php))
- OpenSSL module for SSL / TLS connections ([setup instructions](http://www.php.net/manual/en/openssl.installation.php))

> Support for `ldap_modify_batch` and `ldap_escape` are also available as long as they are present in your current PHP version.

- `ldap_modify_batch` - available in PHP 5.4 branch since 5.4.26 and in higher versions of PHP since 5.5.10
- `ldap_escape` - available since PHP 5.6.0

### Via Composer

[](#via-composer)

`composer require dreamscapes/ldap-core` (visit [Packagist](https://packagist.org/packages/Dreamscapes/ldap-core) for list of all available versions)

Usage
-----

[](#usage)

There are two classes - `Dreamscapes\Ldap\Core\Ldap` and `Dreamscapes\Ldap\Core\Result`, each of which implement part of the native ldap functions as instance methods (some functions which do not operate on the resource objects are static). The differentiating principle is simple - if the function deals with the state of the ldap connection, it is implemented in the first, whereas functions dealing with the data returned from ldap server (the result resource) are implemented in the latter class.

### Deviations

[](#deviations)

All methods are named as close to the original functions as possible, although with some improvements:

1. Ldap v3 protocol is used by default
2. The *ldap\_* prefix is removed from all method names
3. The method names are **camelCased** instead of **underscore\_based**
4. All methods return data by returning them and not by populating variables passed as references
5. Some functions are not implemented (usually because they are redundant)
6. Exceptions are thrown if the ldap protocol encounters an error, and standard PHP warnings and errors are suppressed in most cases

### Example

[](#example)

```
// Load Composer's autoload script...
include 'vendor/autoload.php';

// Import the class into current namespace
use Dreamscapes\Ldap\Core\Ldap;

// If ldap URI is provided, the Ldap instance will also open the connection
// via ldap_connect()
$con = new Ldap('ldap://example.com');
$con->bind('admin@example.com', 'my pass'); // Example AD credentials

// Read the rootDSE entry
$res = $con->read('', 'objectclass=*', ['*']);

// $res is now instance of Result class
echo "Number of entries in resultset: " . $res->countEntries();
print_r($res->getEntries());
```

Documentation
-------------

[](#documentation)

Online API documentation is available [here](http://dreamscapes.github.io/Ldap-Core). To generate API documentation offline:

```
git clone https://github.com/Dreamscapes/Ldap-Core.git
cd Ldap-Core
composer install
make docs

```

Documentation is now available at *./docs/index.html*

License
-------

[](#license)

This software is licensed under the **BSD (3-Clause) License**. See the [LICENSE](LICENSE) file for more information.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 82.7% 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 ~193 days

Recently: every ~326 days

Total

9

Last Release

2913d ago

Major Versions

0.1.0-beta.3 → 1.0.02014-08-31

1.0.0 → 2.0.02014-12-16

2.0.1 → 3.0.02015-03-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/4300d8bf145f9d0db6e15c90199842aad7541376402c2fc2ee86539631100bc4?d=identicon)[Alaneor](/maintainers/Alaneor)

---

Top Contributors

[![robertrossmann](https://avatars.githubusercontent.com/u/3058150?v=4)](https://github.com/robertrossmann "robertrossmann (67 commits)")[![junowilderness](https://avatars.githubusercontent.com/u/1977311?v=4)](https://github.com/junowilderness "junowilderness (9 commits)")[![Furgas](https://avatars.githubusercontent.com/u/715407?v=4)](https://github.com/Furgas "Furgas (5 commits)")

---

Tags

testinglibrarymockdirectoryldapopenldapOOP

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/dreamscapes-ldap-core/health.svg)

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

###  Alternatives

[mockery/mockery

Mockery is a simple yet flexible PHP mock object framework

10.7k526.2M26.9k](/packages/mockery-mockery)[kahlan/kahlan

The PHP Test Framework for Freedom, Truth and Justice.

1.1k1.2M257](/packages/kahlan-kahlan)[quizlet/hammock

Hammock is a stand-alone mocking library for Hacklang.

27445.5k](/packages/quizlet-hammock)[phpcurl/curlwrapper

The simplest OOP wrapper for curl, curl\_multi, curl\_share functions. Use CURL as a dependency, not hard-coded!

12112.0k3](/packages/phpcurl-curlwrapper)[happyr/service-mocking

Make it easy to mock services in a built container

47269.0k2](/packages/happyr-service-mocking)[janmarek/mockista

Mockista is library for mocking, which I've written, because I find mocking in PHPUnit awful.

29222.1k28](/packages/janmarek-mockista)

PHPackages © 2026

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