Sei sulla pagina 1di 6

PHP LDAP CLASS FOR

MANIPULATING
ACTIVE DIRECTORY
Current Stable Version 4.0.0
https://github.com/adldap/adLDAP/releases/tag/v4.0.4
Next Version 5.0.0
Written by Scott Barnett, Richard Hyland email:
scott@wiggumworld.com, adldap@richardhyland.com
https://github.com/adldap/adLDAP/

ABOUT
adLDAP is a PHP class that provides LDAP
authentication and integration with Active Directory.
We'd appreciate any improvements or additions to be
submitted back to benefit the entire community :)

REQUIREMENTS
adLDAP requires PHP 5 and both the LDAP
(http://php.net/ldap) and SSL (http://php.net/openssl)
libraries adLDAP version 5.0.0 will require PHP 5.3+

INSTALLATION

adLDAP is not an application, but a class library


designed to integrate into your own applications.
The core of adLDAP is contained in the 'lib/adLDAP'
directory. Simply copy/rename this directory inside your
own projects.
Edit the file lib/adldap/adLDAP.php and change the
configuration variables near the top, specifically those

for domain controllers, base dn and account suffix, and


if you want to perform anything more complex than use
authentication you'll also need to set the admin
username and password variables too.
From within your code simply require the adLDAP.php
file and call it like so
use \adLDAP;
require_once(dirname(__FILE__) . '/adLDAP.php');
$adldap = new adLDAP();

It would be better to wrap it in a try/catch though


use \adLDAP;
try {
$adldap = new adLDAP();
}
catch (adLDAPException $e) {
echo $e;
exit();
}

Then simply call commands against it e.g.


$adldap->authenticate($username, $password);

or
$adldap->group()->members($groupName);

DOCUMENTATION

You can find our website at


https://github.com/adldap/adLDAP/ or the class
documentation at
https://github.com/adldap/adLDAP/wiki/adLDAPDeveloper-API-Reference

LICENSE
This library is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser
General Public License as published by the Free
Software Foundation; either version 2.1 of the License,
or (at your option) any later version.

This library is distributed in the hope that it will be


useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more
details or LICENSE.txt distributed with this class.

dLDAP Developer API Reference


Rich2k edited this page on Apr 18, 2013 9 revisions
Pages 16
Home
Accented characters
adLDAP Developer API Reference
Apache configuration
Changelog
Code examples
Configuration overloading
Configuration settings
Connecting and Disconnecting
Error handling
FAQ
LDAP over SSL
License
Mod auth ntlm winbind
Samba configuration
Show 1 more pages
Clone this wiki locally
https://github.com/adldap/adLDAP.wiki.git

Clone in Desktop

adLDAP Developer
API Reference
This documentation relates to version 4.0 branch
of adLDAP. Version 4 is not backwards compatible
with code written for prior versions. For
documentation on versions prior to version 4.0,
please visit this page
This API is intended to be an accurate representation of
the current version of the class. A great deal of
knowledge is involved in the LDAP schema, so we
actively encourage people to add to this documentation
if you are able to improve it....
Version 4.0 of adLDAP is a complete re-write of the
library and is not backwards compatible with older
versions. Please take time to read the documentation to
see how to use this class.

Server Requirements

PHP 5
LDAP extensions to PHP
An Active Directory domain controller to connect to,
preferably with a user account with domain
administrator rights
OpenSSL support in PHP if you wish to set or
change/set passwords on a user account

Using adLDAP

Read the documentation on connecting and


disconnecting from your domain controller for more

information on different ways of calling adLDAP.


1 Copy the contents of the src folder to your server
2 Edit the configuring variables in the class itself if you
so wish to
3 From your script add the following code
require_once(dirname(FILE) . '/adLDAP.php');
$adldap = new adLDAP();
It would be better to wrap it in a try/catch though
try {
$adldap = new adLDAP();
}
catch (adLDAPException $e) {
echo $e;
exit();
}

You can alternatively override the configuration when


the class is called by specifying an array with the
options.
You can call adLDAP as follows $adldap = new
adLDAP($options); where $options is an array with one or
more of the following keys
accountSuffix baseDn domainControllers adminUsername
adminPassword realPrimaryGroup useSSL useTLS
recursiveGroups adPort

See the 'examples' and 'connecting and disconnecting'


section for more information

API Function Reference


Guide
Calling adLDAP

connecting and disconnecting

Configuration

Configuration Settings
Configuration Overloading

Functions

User Management and Authentication Functions


Group Management Functions
Folder and Structure Functions
Contact Management Functions
Microsoft Exchange Management Functions
Computer Information Functions

Error Handling

Error Messages and Exceptions

Active Directory Schema

adLDAP attribute mapping to Active Directory


attributes

Miscellaneous

Examples
Changelog
Accented Characters
Active Directory Paging Support

Potrebbero piacerti anche