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=acme,dc=org');

$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

Effortlessly connect to your LDAP servers and start running queries & operations faster than dial up.

Fluent Query Builder

Building LDAP queries has never been so easy. Find the objects you're looking for in a couple lines or less with a fluent interface.

User::whereEnabled()
    ->whereMemberOf('cn=Managers,ou=Groups,dc=acme,dc=org')
    ->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.