Download the PHP package faulkj/ldapclient without Composer
On this page you can find all versions of the php package faulkj/ldapclient. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download faulkj/ldapclient
More information about faulkj/ldapclient
Files in faulkj/ldapclient
Package ldapclient
Short Description A PHP class that simplifies connecting to and searching LDAP directories.
License Unlicense
Homepage https://github.com/faulkj/LDAPClient/:readme
Informations about the package ldapclient
LDAPClient
LDAPClient is a PHP library designed to make LDAP operations easy and flexible. From basic queries to advanced LDAP functionalities, this library offers a wide range of features.
Features
- Simplified LDAP Connection
- User Authentication
- Advanced Search Queries
- Debugging Support
Installation
Methods & Usage
LDAPClient Class
__construct($server, $bindDN, $pass, $baseDN, $options)
Initiate a connection to the LDAP server.
$server
: The LDAP server URL$bindDN
: The DN to bind with$pass
: The password for binding$baseDN
: The base DN for the directory$options
: List of LDAP fields to pull. Allows for custom attribute mappings to align with the specific LDAP system you're working with.
Example:
debug($dbg)
Toggle debugging output for LDAP operations. When enabled, this provides verbose output for troubleshooting.
$dbg
: Boolean to enable or disable debugging
Example:
Returns:
- Current debug state if no parameter is provided
- The LDAPClient object itself, allowing for method chaining, if a parameter is provided
getJSON($filter, $attr = [], $dn = false, $fullDNs = false)
Converts the search result to a JSON format.
$filter
: LDAP filter$attr
: Attributes to fetch$dn
: Optional DN to search under$resolveDNs
: Whether to resolve DNs$stayBound
: Whether to stay bound
Example:
Returns: JSON-formatted string representing the search results.
login($id, $pass, $attr)
Authenticate a user and return their attributes.
$id
: User ID$pass
: Password$attr
: Attributes to fetch
Example:
Returns:
- User object with specified attributes if successful
false
if authentication failsnull
if the user is not found
member($user, $group, $options = [])
Check if a user is a member of a specific LDAP group or groups.
$user
: The user ID to check$group
: Group or array of groups to check membership$options
: Optional array for additional attribute mappings (merges with default options)
Example:
Returns:
true
if the user is a memberfalse
if the user is not a membernull
if the user is not found
photo($user)
Retrieves the photo for a specified user.
Example:
Returns: Outputs the image directly to the screen if available, a blank image if not
search($filter, $attr, $dn, $resolveDNs, $stayBound)
Perform an LDAP search.
$filter
: LDAP filter$attr
: Attributes to fetch$dn
: Optional DN to search under$resolveDNs
: Whether to resolve DNs$stayBound
: Whether to stay bound
Example:
Returns:
- Array of LDAP records if multiple records are found
- Single LDAP record if only one is found
- null if no records are found