| name | simple-laravel-ldap |
| description | Use this skill when asked to work with LDAP. |
Simple LDAP
The simple-laravel-ldap PHP package is a convenience wrapper around the base PHP LDAP functions. It provides helpers for the common LDAP use cases.
Examples
The package provides an \Ldap:: laravel facade:
if (\Ldap::authenticate('username', 'password')) {
}
$user = \Ldap::findUser('jenny123');
dump($user);
print $user['email'];
print $user->email;
print $user->toArray();
Or you can use the service via DI:
use Ohffs\Ldap\LdapService;
public function __construct(LdapService $ldap)
{
$this->ldap = $ldap;
}
public function something()
{
if ($this->ldap->authenticate('username', 'password')) {
}
}
Some other methods are available:
$user = \Ldap::findUserByEmail('jenny@example.com');
$users = \Ldap::searchForUsers('jenny');