Download the PHP package comodojo/ldaph without Composer
On this page you can find all versions of the php package comodojo/ldaph. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download comodojo/ldaph
More information about comodojo/ldaph
Files in comodojo/ldaph
Package ldaph
Short Description poor man's php ldap class
License MIT
Homepage https://comodojo.org
Informations about the package ldaph
comodojo.ldaph
poor man's php ldap class
Ldaph is a simple library made to handle LDAP/ActiveDirectory authentication and search.
It supports:
- ssl (ldaps)
- tls
- single sign on (Active Directory)
Installation
Install composer, then:
composer require comodojo/ldaph 1.0.*
Basic Usage
-
Creating an instance
Class constructor expects ldap server and port as parameters. Wrap it in a try/catch block, since it may generate a
LdaphException
in case of wrong parameters or missed php ext. -
User authentication
Defining DN, there is a special word USERNAME that will be replaced with first auth() parameter ($username).
Examples of DN:
- "[email protected]" (for Active Directory)
- "uid=USERNAME,dc=example,dc=com" (for openLDAP)
-
Search LDAP tree
Searching into ldap tree requires, at least:
- base DN (base)
- search DN (searchbase)
- bind DN (dn)
- account (user/pass)
search()
method will list ldap tree using this parameters.Special word 'PATTERN' in searchbase will be replaced with first
search()
parameter.Second parameter (if true) will return results in a more convenient, array-based form.
Examples of searchbase (if you are looking for usernames):
- "(&(!(objectClass=computer))(|(anr=PATTERN)))" (for Active Directory)
- "(uid=PATTERN)" (for openLDAP)
Documentation
Contributing
Contributions are welcome and will be fully credited. Please see CONTRIBUTING for details.
License
comodojo/ldaph
is released under the MIT License (MIT). Please see License File for more information.