laminas-ldap
A PHP library for binding, searching, and modifying entries in an LDAP directory.
Repository Health
Technical Analysis
laminas-ldap wraps PHP’s native ext-ldap functions in an object-oriented API for working with LDAP directories such as Active Directory or OpenLDAP. It covers connection/binding, filter construction, entry search and iteration, node/tree manipulation, and LDIF encoding, and is part of the Laminas project (the community-maintained successor to Zend Framework).
What You Get
- An
Ldapconnection/bind class wrapping ext-ldap with configurable options (host, port, bind DN, credentials) - A composable
FilterAPI (AndFilter,OrFilter,NotFilter,MaskFilter,StringFilter) for building LDAP search filters without manual string escaping NodeandCollectionabstractions for reading and iterating LDAP directory entries and subtrees- LDIF encoding support via
Ldif\Encoderfor import/export of directory data - A dedicated exception hierarchy (
LdapException,InvalidArgumentException,BadMethodCallException) for structured error handling
Common Use Cases
- Authenticating application users against a corporate Active Directory or OpenLDAP server
- Searching and paging through directory entries (users, groups, org units) with composed filter objects
- Synchronizing or provisioning directory entries (create/update/delete) from an internal admin tool
- Exporting or importing directory data in LDIF format for backups or bulk directory changes
Under The Hood
Architecture: The library centers on the Ldap class as the connection/session object, with Filter implementing a composite pattern (AbstractFilter/AbstractLogicalFilter base classes) so filters combine via and()/or()/not(), while Node and Collection wrap raw ext-ldap result arrays into iterable, attribute-aware objects (RootDse, Schema as specialized node types). Tech Stack: PHP 8.2–8.5, requiring the ext-ldap extension, with dev-only dependencies on other Laminas components (laminas-config, laminas-eventmanager, laminas-stdlib) and Symfony console/filesystem/string for tooling — the runtime dependency surface is otherwise just PHP itself. Code Quality: The repo runs PHPUnit (11.x) and Psalm static analysis (with a maintained psalm-baseline.xml) under a documented CI workflow, enforces laminas-coding-standard, and structures tests under a parallel test/ tree mirroring src/, indicating disciplined ongoing maintenance despite the component’s small user base. API Design: The filter-builder API keeps LDAP query construction type-safe and composable rather than string-concatenated, and exceptions implement a shared ExceptionInterface so callers can catch broadly or narrowly — the tradeoff is a steeper initial learning curve than raw ldap_* calls for developers unfamiliar with LDAP concepts like DNs and object classes.
Used by 2 apps in this directory
EspoCRM
Marketing · Ecommerce · CRM
Open-source CRM platform with metadata-driven customization, field-level permissions, and a full REST API — deploy on your own infrastructure.
opencloud
File Storage
Open source file management and collaboration platform that keeps your data under your control, no database required.