Integrate LDAP into your PHP applications

No hair-pulling necessary.

$user = User::create([
    'cn' => 'Steve Bauman',
    'company' => 'Acme',
    'password' => 'P@ssw0rd',

$administrators = Group::find('cn=Admins,dc=local,dc=com');

use LdapRecord\Connection;

$connection = new Connection([
    'hosts' => [''],
    'base_dn' => 'dc=local,dc=com',
    'username' => 'cn=user,dc=local,dc=com',
    'password' => 'SuperSecret',


$users = $connection->query()->where('title', '=', 'Accountant')->get();

Up and running fast

Connect to your LDAP servers and start running queries & operations in minutes.

Fluent Query Builder

Find the objects you're looking for in a couple lines or less with a fluent search builder.

    ->whereNotContains('company', 'Acme')
    ->each(function ($user) {
        $user->company = 'Acme Organization';

$user = new User();

$user->cn = 'Steve Bauman';
$user->title = 'Developer';
$user->samaccountname = 'sbauman';
$user->company = 'Acme';
$user->mail = '';
$user->givenname = 'Steve';
$user->sn = 'Bauman';
$user->password = 'Super-Secret';


Supercharged Active Record

Create and modify LDAP objects with ease. All LDAP objects are individual models. Simply modify the attributes on the model and save it to persist the changes to your LDAP server.