Introduction

Introduction – What Net_LDAP2 is and general information

Welcome to Net_LDAP2!

Net_LDAP2 is a clone of Perls Net::LDAP package. PEAR Net_LDAP2 for PHP does, besides some own features, provide most of Perl Net::LDAP methods. Net_LDAP2 allows you to query and manipulate the data stored in directory servers using PHP in an object-oriented way. A directory server is a database server providing a hierarchical database and is usually queried using the LDAP protocol.

Net_LDAP2 is intendet as replacement of Net_LDAP.

Classes of the Net_LDAP2 package

The following table gives you a short overview which classes are available in Net_LDAP2 and what they can be used for. Their relations will be explained too.

Classes of Net_LDAP2
Class name Description
Net_LDAP2 This is the main class. It enables you to connect and bind to a LDAP-server and to run ldap-querys like searching and manipulating entries. Most common, you will run a search using a LDAP-Filter and will get a Net_LDAP2_Search-object. You may also fetch an entry directly, which gives you a Net_LDAP2_Entry-object.
Net_LDAP2_Search Objects of this class are returned from search querys. You can use this object to retrieve informations about a search result, like how much entries you have found for the provided filter. You can retrieve the found entries as Net_LDAP2_Entry-objects in various forms: sorted, consecutively starting from the end or beginning or unsorted at once.
Net_LDAP2_Entry Objects of this kind are either produced by casting fresh entries manually, by retrieving the result of a LDAP-search or by fetching an entry directly. It gives you the possibility to read and/or manipulate the attributes of an entry which describes the characteristic of the specific object.
Net_LDAP2_Util The utility class contains only static methods, so you should not need to make an instance of it. It features some helpful methods, some of them are used internally by Net_LDAP2 but may be used externally from you as well. The most methods deal with escaping issues, since LDAP has some metacharacters with special meaning so that they usually need to be properly escaped.
Net_LDAP2_Filter You are free to give LDAP-Filters on your own to the Net_LDAP2->search() method, however this has some drawbacks (including escaping issues). For this reason, you can use the Net_LDAP2_Filter class to easily build and combine your filters. LDAP filters are extensively explained at the chapter LDAP filters.
Net_LDAP2_Error This is a error class. Most methods of Net_LDAP2 will return a object of this class if something went wrong. You can use this object to identify errors and to get detailed knowledge on what went wrong. See Errorhandling for more information.
Net_LDAP2_LDIF LDIF files are human readable, plain text files containing directory data and/or change commands, much like an SQL file. Unlike SQL files, it is data centric, not action centric. Net_LDAP2_LDIF enables you to convert between Net_LDAP2_Entry-objects and LDIF files. Please note, that Net_LDAP2_LDIF has a little different error handling explained later.
Net_LDAP2_SimpleFileSchemaCache Net_LDAP2 features a schema caching facility. This class implements a simple file based cache that allows Net_LDAP2 to store the schema data that get fetched from LDAP inside a file to accelerate schema access. Caching the schema can gain some performance, especially with slow servers or connections. You may use this cache class for example to store the schema object in a linux tmpfs which will result in caching the schema in the computers memory, enabling nearly instant access. This cache also features a cache ageing mechanism. Please see Schema caching for more information.