Getting Started

First, create the LdapWrapper object. Then, create the LdapSearch object that can be used to search the directory.

<?php
use Vespula\Ldap\LdapWrapper;
use Vespula\Ldap\LdapSearch;

$wrapper = new LdapWrapper;

$uri = 'ldap.mycompany.org';

// basedn is the dn used for searches
// binddn is the dn to bind to as a user
// bindpw is the bind password for the user.
// See ldap_bind() in the PHP manual

$bindOptions = [
    'basedn'=>'OU=users,OU=mycompany,OU=org',
    'binddn'=>'CN=juser,OU=users,OU=mycompany,OU=org',
    'bindpw'=>'********'
];

$ldapOptions = [
    LDAP_OPT_PROTOCOL_VERSION=>3,
    LDAP_OPT_REFERRALS=>0
];

// 389 is the default
$port = 389;

$ldap = new LdapSearch($wrapper, $uri, $bindOptions, $ldapOptions, $port);