zendframework/zend-ldap
Zend LDAP provides PHP tools for LDAP directory operations like binding, searching, and modifying entries. This repository was abandoned on 2019-12-31 and has moved to laminas/laminas-ldap.
use Zend\Ldap\Ldap;
$options = [/* ... */];
$ldap = new Ldap($options);
$ldap->bind();
$hm = $ldap->getEntry('cn=Hugo Müller,ou=People,dc=my,dc=local');
/*
$hm is an array of the following structure:
[
'dn' => 'cn=Hugo Müller,ou=People,dc=my,dc=local',
'cn' => ['Hugo Müller'],
'sn' => ['Müller'],
'objectclass' => ['inetOrgPerson', 'top'],
...
]
*/
use Zend\Ldap\Ldap;
$options = [/* ... */];
$ldap = new Ldap($options);
$ldap->bind();
$isThere = $ldap->exists('cn=Hugo Müller,ou=People,dc=my,dc=local');
use Zend\Ldap\Ldap;
$options = [/* ... */];
$ldap = new Ldap($options);
$ldap->bind();
$childrenCount = $ldap->countChildren('cn=Hugo Müller,ou=People,dc=my,dc=local');
use Zend\Ldap\Ldap;
$options = [/* ... */];
$ldap = new Ldap($options);
$ldap->bind();
$result = $ldap->search(
'(objectclass=*)',
'ou=People,dc=my,dc=local',
Ldap::SEARCH_SCOPE_ONE
);
foreach ($result as $item) {
echo $item["dn"] . ': ' . $item['cn'][0] . PHP_EOL;
}
use Zend\Ldap\Attribute;
use Zend\Ldap\Ldap;
$options = [/* ... */];
$ldap = new Ldap($options);
$ldap->bind();
$entry = [];
Attribute::setAttribute($entry, 'cn', 'Hans Meier');
Attribute::setAttribute($entry, 'sn', 'Meier');
Attribute::setAttribute($entry, 'objectClass', 'inetOrgPerson');
$ldap->add('cn=Hans Meier,ou=People,dc=my,dc=local', $entry);
use Zend\Ldap\Ldap;
$options = [/* ... */];
$ldap = new Ldap($options);
$ldap->bind();
$ldap->delete('cn=Hans Meier,ou=People,dc=my,dc=local');
use Zend\Ldap\Attribute;
use Zend\Ldap\Ldap;
$options = [/* ... */];
$ldap = new Ldap($options);
$ldap->bind();
$hm = $ldap->getEntry('cn=Hugo Müller,ou=People,dc=my,dc=local');
Attribute::setAttribute($hm, 'mail', 'mueller@my.local');
Attribute::setPassword($hm, 'newPa$$w0rd', Attribute::PASSWORD_HASH_SHA1);
$ldap->update('cn=Hugo Müller,ou=People,dc=my,dc=local', $hm);
use Zend\Ldap\Ldap;
$options = [/* ... */];
$ldap = new Ldap($options);
$ldap->bind();
$ldap->copy(
'cn=Hugo Müller,ou=People,dc=my,dc=local',
'cn=Hans Meier,ou=People,dc=my,dc=local',
true
);
use Zend\Ldap\Ldap;
$options = [/* ... */];
$ldap = new Ldap($options);
$ldap->bind();
$ldap->moveToSubtree(
'cn=Hugo Müller,ou=People,dc=my,dc=local',
'ou=Dismissed,dc=my,dc=local',
true
);
How can I help you explore Laravel packages today?