Table of Contents

Configuration

When initializing a new imlldap object or use setConfig then you can apply these values:

Var Type Desciption Example
server string Server connection with “ldap(s)://host[:port]” ‘ldaps://ldap.example.com’
DnLdapUser string Bind user as ldap rdn or dn ‘cn=Lookup,ou=ServiceAccounts,dc=org,dc=example.com’
PwLdapUser string password for bind user ‘PasswordOfLookupUser’
DnUserNode string for user methods: set a DN where users are ‘ou=People,ou=ORG,dc=org,dc=example.com’
protoVersion integer ldap protocol version 3
debugLevel integer Value for LDAP_OPT_DEBUG_LEVEL when using debugOn() 7

Example:

As an example I create a hash named $aConfig and save it as “inc_config.php”.

return [
    ...
    'ldap-master' => [
        'server'     => 'ldaps://ldap.example.com',
        'DnLdapUser' => 'cn=Lookup,ou=Service,dc=some,dc=example.com',
        'PwLdapUser' => 'PasswordOfLookupUser',
        'DnUserNode' => 'ou=People,dc=some,dc=example.com',
        'debugLevel' => 0,
    ],
    ...
];
$aConfig = require_once('inc_config.php');
require_once '[APPROOT]/classes/ldap.class.php';

$oLdap=new imlldap($aConfig['ldap-maser']);

// ...

// update a single config item
$oLdap->setConfig([
    'debugLevel' => 3,
]);