A framework for
Rapid LDAP Integration

LdapRecord is a framework that helps you quickly integrate LDAP into your PHP applications.

LDAP Models.

Each LDAP object type has its own model. If you've used Laravel's Eloquent, you'll feel right at home.

use LdapRecord\Models\Model;

class User extends Model
    protected $objectClasses = [
$user = User::create([
    'company'        => 'LdapRecord',
    'title'          => 'Web Developer',
    'password'       => 'P@ssw0rd',
    'samaccountname' => 'sbauman',
    'mail'           => 'sbauman@acme.org',
    'givenname'      => 'Steve',
    'sn'             => 'Bauman',
    ->whereNotContains('company', 'acme')
    ->each(function ($user) {
        $user->company = 'Acme Organization';


Fluently query
Like a boss.

LdapRecord's filter builder provides a clean, chainable API, that's easy to read and write.

Come included.

Events, caching, logging, testing tools, relationships, accessors, mutators, and more.

$dispatcher = Container::getEventDispatcher();

$dispatcher->listen(Saved::class, function (Saved $event) {
        new LdapObjectModified($event->getModel())
$connection = Container::getDefaultConnection();


$until = new \DateTime('tomorrow');

$users = User::cache($until)->get();
$user = User::find('cn=John Doe,dc=local,dc=com');

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

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

Ready to get started?

Show me the way