LDAP for PHP · v4

LdapRecord Core

Work with your LDAP directory using expressive PHP models. Search for users, manage groups, and update directory entries with an API that feels familiar.

use LdapRecord\Models\ActiveDirectory\User;

$user = User::query()
    ->where('mail', '[email protected]')
    ->firstOrFail();

$groups = $user->groups()->get();

foreach ($groups as $group) {
    echo $group->getName();
}

$user->title = 'Engineering Manager';
$user->save();
An Active Directory example, after configuring your connection.

Work with your directory

Your first LDAP query

  1. 1

    Install the package

    Check the requirements and install with Composer.

  2. 2

    Connect your directory

    Set your server, credentials, and search base.

  3. 3

    Run your first query

    Connect the pieces with a complete PHP example.

Need a hand getting started?