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');

$user->groups()->attach($administrators);
use LdapRecord\Connection;

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

$connection->connect();

$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.

User::whereEnabled()
    ->whereMemberOf('cn=Managers,ou=Groups,dc=local,dc=com')
    ->whereNotContains('company', 'Acme')
    ->get()
    ->each(function ($user) {
        $user->company = 'Acme Organization';

        $user->save();
    });
$user = new User();

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

$user->save();

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.