Yii 1.1: ldaprecord

Ldap access a la CActiveRecord

Current version 0.4


  • Usage similar to CActiveRecord
    • similar call syntax (see Usage)
    • use of ActiveForms
    • define relations analogous to CActiveRecord
  • Read / Modify / Save a Node
  • Read a subtree


Yii 1.1 or above


  1. Unzip ldaprecord.zip and move the ldaprecord folder to your /protected/extensions folder
  2. Add the following code to your /protected/config/main.php
            'class' => 'ext.ldaprecord.LdapComponent',
            'server' => 'ldap://',
            'port' => 389,
            'bind_rdn' => 'cn=Manager,dc=domain,dc=com',
            'bind_pwd' => '<pwd>',
            'base_dn' => 'dc=domain,dc=com',

Next steps

  • implement a DataProvider and a Sort class (can be used with 'zii.widgets.CListView')
  • implement a caching mechanism for objectclasses and attributetypes
  • read attribute limitations from Ldap server


Read a Ldap node by DN

$node = CLdapRecord::model('<yourclassname>')->findByDn('<theDN>');

Read a Ldap subtree

$nodes = CLdapRecord::model('LdapSubTree')->findSubTree(<attributes>);

Howto set relations
Edit method relations() in your class inherited from CLdapRecord (howto see Comment CLdapRecord->relations()).

Total 2 comments

#15556 report it
dillibabu at 2013/11/21 05:35am
LDAP Config in yii web application for user aithentication

Hi I am new to yii i am using the above extension for ldap config for user authentication please can u say the use of the following code and where i have to add this in the web application $node = CLdapRecord::model('')->findByDn('');

#4347 report it
equatorcity at 2011/06/28 03:09am
Not Error Free

This extension is not error free for error_reporting = E_ALL configuration in php.ini.

I must change to error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED for running well.

I hope you will fix it.

Leave a comment

Please to leave your comment.

Create extension