A framework for
Rapid LDAP Integration
LdapRecord is a framework that helps you quickly integrate LDAP into your PHP applications.
Declarative
LDAP Models.
Each LDAP object type has its own model. If you've used Laravel's Eloquent or an Active Record equivalent, you'll feel right at home.
use LdapRecord\Models\Model;
class User extends Model
{
protected $objectClasses = [
'top',
'person',
'organizationalperson',
'user',
];
}
$user = User::create([
'company' => 'LdapRecord',
'title' => 'Web Developer',
'password' => 'P@ssw0rd',
'samaccountname' => 'sbauman',
'mail' => '[email protected]',
'givenname' => 'Steve',
'sn' => 'Bauman',
]);
Query
Like a boss.
LdapRecord's filter builder provides a clean, chainable API, that's easy to read and write.
User::in('ou=office,dc=local,dc=com')
->whereEnabled()
->whereMemberOf('cn=managers,ou=groups,dc=local,dc=com')
->whereNotContains('company', 'acme')
->get()
->each(function ($user) {
$user->company = 'Acme Organization';
$user->save();
});
Batteries
Come included.
Events, caching, logging, testing tools, relationships, accessors, mutators, and more. They all come out-of-the-box.
$dispatcher = Container::getEventDispatcher();
$dispatcher->listen(Saved::class, function (Saved $event) {
Mail::send(
new LdapObjectModified($event->getModel())
);
});
$connection = Container::getDefaultConnection();
$connection->setCache($myAppCache);
$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;
}
Integrate faster
Everything you'll need to integrate LDAP.
Works With All Directories
Support for Active Directory, OpenLDAP and 389 Directory Server is included.
Fluent Filter Builder
Effortlessly build complex LDAP filters with easy to read and write fluent syntax.
Friends In High Places
Includes a first-party feature packed integration with the Laravel framework.